search for: docoerc

Displaying 1 result from an estimated 1 matches for "docoerc".

Did you mean: docoerce
2009 Jun 23
4
Apply as.factor (or as.numeric etc) to multiple columns
Hi R-helpers, I have a dataframe with 60columns and I would like to convert several columns to factor, others to numeric, and yet others to dates. Rather than having 60 lines like this: data$Var1<-as.factor(data$Var1) I wonder if it's possible to write one line of code (per data type, e.g. factor) that would apply a function (e.g., as.factor) to several (non-contiguous) columns. So, I