I want to change the type to factor of all variables in a data frame whose 
names match a certain pattern.
So here I am trying to change the type to factor of all variables whose name 
begins with namestub in the dataframe df.
attach(df)sapply(grep(glob2rx("namestub*"),names(df)),as.factor)
But this doesn't work since
>levels(df$namestub1)NULL

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to