0

I have a column in R that looks like value 10.01% 20.02% . . . .

I want it to look like value 10.01 20.02 ....

since the previous version is taking it as factors by default while I want the row to be considered as decimals.

krishna
  • 405
  • 6
  • 25

1 Answers1

1

You can use gsub() (and might want to wrap it in an as.numeric() to convert it to "double" data type)

# setup
x <- c("10.01%", "20.02%")
# solution 
as.numeric(gsub("%", "", x))
rg255
  • 4,119
  • 3
  • 22
  • 40