Hello,
I need to change from character to numeric a list of variables that are in a data frame.
I tried with a loop, but I failed.
Then I found and example similar to what I need, but It operates with column number and no column name. Here I will load mtcars and I will make the opposite, converting from numeric to character.
mtcars
dat=mtcars
list=c("cyl","carb","hp")
dat[, list] <- sapply(dat[, list], as.character)
The code I wrote is it ok? I need to confirm this.