[R] groupedData

Douglas Bates
Wed, 30 Oct 2002 23:36:47 -0000

"Dr. Peter Schlattmann" <peter.schlattmann at
medizin.fu-berlin.de> writes:

> Dear all,
>
> I tried to create a groupedData object, where the grouping factor
> is not ordered.
>
> Here is the code:
>
> library(nlme)
>
test<-groupedData(conc~Time|Subject,order.groups=F,data=as.data.frame(Theoph))
> > getGroups(test)
>
> Levels: 6 < 7 < 8 < 11 < 3 < 2 < 4 < 9 < 12 < 10
< 1 < 5
>
> I still get an ordered factor. As always thanks for your help

It's because Theoph$Subject is already an ordered factor.  To get rid
of the property of being ordered you must convert it to character and
back to a factor.

> data(Theoph)
> theo <- as.data.frame(Theoph)
> theo$Subject <- factor(as.character(theo$Subject))
> test <- groupedData(conc~Time|Subject,order.groups=FALSE,data=theo)
> getGroups(test)
...
Levels: 1 10 11 12 2 3 4 5 6 7 8 9
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._