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.
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.
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))