[R] reodering factor

John Sorkin jsorkin at grecc.umaryland.edu
Fri May 4 04:10:50 CEST 2007


R 2.4.1 
Windows XP

How does one reorder a factor?


I have the following data:
> factor(data$Group)
 [1] ZZ ZT ZT ZZ ZZ ZT ZZ ZZ ZT ZT ZT ZT ZZ ZT ZT ZZ ZT ZZ ZT ZZ ZT ZT ZZ ZZ ZT ZZ ZT ZZ ZT ZZ ZZ ZT ZZ ZT
Levels: ZT ZZ

In my regression (i.e. lm(y~data$Group) ZT is taken as the reference category and I get an estimate for ZZ. I would like ZZ to be the reference category and obtain an estimate for ZT.

Thank,
John

John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)

Confidentiality Statement:
This email message, including any attachments, is for the so...{{dropped}}



More information about the R-help mailing list