Re: [R] converting column to factor *within* a data frame

2003-11-05 Thread Prof Brian Ripley
On Wed, 5 Nov 2003, Pascal A. Niklaus wrote: Hi all, I repeatedly encounter the following problem: After importing a data set into a data frame, I wish to set a column with numeric values to be a factor, but can't figure out how to do this. Also, I do not wish to write as.factor(x) all

RE: [R] converting column to factor *within* a data frame

2003-11-05 Thread Simon Fear
Your problem is with scoping, not the conversion per se: attach(ngrad) is.factor(STNW) [1] FALSE At this moment, STNW is the same as ngrad$STNW ngrad$STNW-factor(STNW) ## doesn't work Yes it does work, try looking at is.factor(ngrad$STNW) is.factor(STNW) [1] FALSE After you