Hello, everyone,

aside from Rolf's hint (and Richard's warning!) you could also consider relevel():

viagraData$dose <- relevel( viagraData$dose, ref = "placebo")

 Hth  --  Gerrit

On Fri, 5 Jun 2015, Rolf Turner wrote:

On 05/06/15 11:08, Jim Lemon wrote:
Hi James,
You can change the order of levels like this:

levels(viagraData$dose)<-c("placebo","low dose","high dose")

<SNIP>

As Richard Heiberger has pointed out, this is wrong.

What *does* work is:

viagraData$dose)<-factor(viagraData$dose,
                       levels=c("placebo","low dose","high dose")

This is a trap into which many a Young Player (including my very good self) has fallen.

cheers,

Rolf Turner



--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to