What is the most efficient way to apply gsub to various columns? The following does not work
gsub
x1=c(\"10%\",\"20%\",\"30%\") x2=c(\"60%\",\"50%\",
Or, you could try the lapply solution:
lapply
as.data.frame(lapply(x, function(y) gsub("%", "", y))) x1 x2 x3 1 10 60 1 2 20 50 2 3 30 40 3