I have a dataframe with a bunch of columns that I need to convert to the numeric type. I have written the following code to try to do this, however it is saying the replacem
You can use sapply for this:
dat <- sapply( dat, as.numeric )
If not every column needs converting:
library( taRifx ) dat <- japply( dat, which(sapply(dat, class)=="character"), as.numeric )