Skip to content
Back to formatted view

Raw Message

Message-ID: <1304441507167-3492979.post@n4.nabble.com>
Date: 2011-05-03T16:51:47Z
From: Rob Cassidy
Subject: Help converting a data.frame to ordered factors
In-Reply-To: <1304435186239-3492705.post@n4.nabble.com>

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.