[prev in list] [next in list] [prev in thread] [next in thread]
List: r-help
Subject: [R] converting column to factor *within* a data frame
From: "Pascal A. Niklaus" <Pascal.Niklaus () unibas ! ch>
Date: 2003-11-05 8:50:01
[Download RAW message or body]
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<-"
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic