[R] Stack with factors

Kenneth Roy Cabrera Torres krcabrer at une.net.co
Thu Apr 1 11:43:54 CEST 2010


Hi R users:

I found that I cannot stack() a data.frame with factors.

db1<-data.frame(replicate(6,factor(sample(c("A","B"),6,replace=TRUE))))
str(db1)
db2<-stack(db1)
db2

"db2" does not have any row.

How can I stack them by the variables X1,X2,...,X6?

Thank you for your help.

Kenneth



More information about the R-help mailing list