Re: [R] change character to factor in data frame

2009-09-09 Thread Henrique Dallazuanna
You could use lapply indeed of sapply: irisf[,index] <- lapply(irisf[,index], as.factor) str(irisf) On Wed, Sep 9, 2009 at 8:06 AM, Petr PIKAL wrote: > Dear all > > I have a simple problem which I thought is easy to solve but what I tried > did not work. I want to change character variables to

[R] change character to factor in data frame

2009-09-09 Thread Petr PIKAL
Dear all I have a simple problem which I thought is easy to solve but what I tried did not work. I want to change character variables to factor in data frame. It goes easily from factor to character, but I am stuck in how to do backwards conversion. Here is an example irisf<-iris irisf[,2]<-f