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 are no easier way to go through.... (the loop is not "R"
style, for the least). However, I cannot do
it otherway so far...
Cheers,
Patrick
______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html