[R] Help converting a data.frame to ordered factors

Rob Cassidy rob.cassidy at concordia.ca
Tue May 3 18:51:47 CEST 2011


Hi again,
Now that I have the data.frame as ordered factors, when I try to transpose
it, I lose the factor orders.

> datfact<-data.frame(c1,c2,c96)
> sapply(datfact, class)
     c1        c2        c96      
[1,] "ordered" "ordered" "ordered"
[2,] "factor"  "factor"  "factor" 
>
> dafacT<-as.data.frame(t(datfact))
> sapply(datfacT,class)
   item1    item2    item3    item4   ...
"factor" "factor" "factor" "factor" ...
> 
> 
Is there a simple way to re-impose ordering on the transposed df? or
alternatively to transpose the df without losing the ordering?

Many thanks,
Robert

--
View this message in context: http://r.789695.n4.nabble.com/Help-converting-a-data-frame-to-ordered-factors-tp3490838p3492979.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list