From r-help Wed Nov 05 08:50:01 2003 From: "Pascal A. Niklaus" Date: Wed, 05 Nov 2003 08:50:01 +0000 To: r-help Subject: [R] converting column to factor *within* a data frame X-MARC-Message: https://marc.info/?l=r-help&m=107151311420742 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 the time. I can create a new vector with x <- factor(x), but the new vector resides outside the attached data frame. Pascal > attach(ngrad) > is.factor(STNW) [1] FALSE > ngrad$STNW<-factor(STNW) ## doesn't work > is.factor(STNW) [1] FALSE > is.factor(STNW) <- T ## doesn't work either Error: couldn't find function "is.factor<-"