0

I have the DF:

KEY <- c(12,55,889)
FOOD <- c("RICE","TOMATO","MANGO")
CAR <- c("BMW.3","FERRARI.12","TOYOTA.58")
DF <- data.frame(KEY,FOOD,CAR)

How do I replace the dot in the "CAR" column?

I expect this result

    KEY <- c(12,55,889)
    FOOD <- c("RICE","TOMATO","MANGO")
    CAR <- c("BMW3","FERRARI12","TOYOTA58")
    DF <- data.frame(KEY,FOOD,CAR)
Bruno Avila
  • 296
  • 2
  • 10

1 Answers1

2
gsub("\\.","",CAR)
[1] "BMW3"      "FERRARI12" "TOYOTA58" 
user2974951
  • 9,535
  • 1
  • 17
  • 24