[R] ordering levels
Chuck Cleland
ccleland at optonline.net
Wed Dec 22 13:13:39 CET 2004
testf <- ordered(testf, levels=c("red", "blue", "white"))
?ordered
Anne wrote:
> Hello!
> I would like to know if there is a simple way to reorder levels of a given factor.Let's say that the vector
> testf<-factor(c("red","red","red","blue","blue","white"))
> levels(testf) : blue red white
>
> should have reordered levels such as
> levels(testf) : red blue white
>
> (this is for presentation purposes)
> I guess I'm looking for a generalized version of "relevel"...
>
> Thanks
>
> Anne
>
> ----------------------------------------------------
> Anne Piotet
> Tel: +41 79 359 83 32 (mobile)
> Email: anne.piotet at m-td.com
> ---------------------------------------------------
> M-TD Modelling and Technology Development
> PSE-C
> CH-1015 Lausanne
> Switzerland
> Tel: +41 21 693 83 98
> Fax: +41 21 646 41 33
> --------------------------------------------------
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
--
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 452-1424 (M, W, F)
fax: (917) 438-0894
More information about the R-help
mailing list