6-02-2012, 11:03 (-0800); Judith Flores escriu: > The name of the column will be saved in an object called: > > variab > > the data frame is called df. > > > If I try to the do following: > > df[variab]<-factor(df[variab], levels=c("A2B","B31","C33")) > > it won't work because df[variab] is a data frame.
I think you need to use df[[variab]] instead. Cheers, Ernest ______________________________________________ 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.