Home > Enterprise >  remove dots from strings in R
remove dots from strings in R

Time:06-09

I want to remove all dots in a df column of prices, all integers. The data:

df <- data.frame(price = c(1.800.000, 900.000, 1.500.000, ...))

I want:

price
1800000
900000
1500000

I have tried gsub('.', '', as.character(df$price)), but I got only empty strings. What could I do?

CodePudding user response:

Try this

gsub('\\.', '', as.character(df$price))
  • Related