Displaying 1 result from an estimated 1 matches for "myforet2".
2004 Oct 09
2
conversion of a data.frame of numerics to a data.frame of factors
Hi,
I am trying to convert a data.frame of numerics (this could be a matrix as well in this case) into a data.frame of factors.
I did it in a way that is less than direct...
myforet2<-t(myforet)
for (i in 1:length(myforet2[1,])) {
if (i == 1)myforetfact<-list(as.factor(myforet2[,i]))
else myforetfact<-c(myforetfact,list(as.factor(myforet2[,i])))
}
myforetfact<-data.frame(myforetfact)
names(myforetfact)<-row.names(myforet)
Here again, I wonder if there ar...