I run into a problem when converting character of percentage to numeric. E.g. I want to convert \"10%\" into 10%, but
as.numeric(\"10%\")
r
I wanted to convert an entire column and combined the above answers.
pct_to_number<- function(x){ x_replace_pct<-sub("%", "", x) x_as_numeric<-as.numeric(x_replace_pct) } df[['ColumnName']] = pct_to_number(df[['ColumnName']])