Sorry, Jim that doesn't do the right thing.
> tmp <- factor(c("mm", "cm", "dm", "m", "km")) > levels(tmp) [1] "cm" "dm" "km" "m" "mm" > tmp [1] mm cm dm m km Levels: cm dm km m mm > levels(tmp) <- c("mm", "cm", "dm", "m", "km") > tmp [1] km mm cm m dm Levels: mm cm dm m km > ## back to the begining > tmp <- factor(c("mm", "cm", "dm", "m", "km")) > tmp [1] mm cm dm m km Levels: cm dm km m mm > tmp <- factor(tmp, levels=unique(tmp)) > tmp [1] mm cm dm m km Levels: mm cm dm m km > Rich On Thu, Jun 4, 2015 at 7:08 PM, Jim Lemon <drjimle...@gmail.com> wrote: > Hi James, > You can change the order of levels like this: > > levels(viagraData$dose)<-c("placebo","low dose","high dose") > > Although I don't know the exact names of the variable and its levels. > > Jim > > On Fri, Jun 5, 2015 at 7:19 AM, Richard M. Heiberger <r...@temple.edu> wrote: >> This example is based on ?glht >> >>> data(warpbreaks) >>> glht(amod, linfct = mcp(tension = "Dunnett")) >> >> General Linear Hypotheses >> >> Multiple Comparisons of Means: Dunnett Contrasts >> >> >> Linear Hypotheses: >> Estimate >> M - L == 0 -10.0 >> H - L == 0 -14.7 >>> levels(warpbreaks$tension) >> [1] "L" "M" "H" >>> warpbreaks$tension <- factor(warpbreaks$tension, levels=c("H","M","L")) >>> amod <- aov(breaks ~ tension, data = warpbreaks) >>> glht(amod, linfct = mcp(tension = "Dunnett")) >> >> General Linear Hypotheses >> >> Multiple Comparisons of Means: Dunnett Contrasts >> >> >> Linear Hypotheses: >> Estimate >> M - H == 0 4.72 >> L - H == 0 14.72 >> >> >> Changing the order of the levels is easy. Rearranging the data itself >> is not necessary. >> >> Rich >> >> On Thu, Jun 4, 2015 at 3:42 PM, James F. Henson >> <james_hen...@suagcenter.com> wrote: >>> Greetings >>> >>> Below is my code. >>> >>> library("multcomp") >>> viaModel1 <- aov(libido ~ dose, data=viagraData) >>> dunnettModel <- glht(viaModel1 , linfct = mcp(dose = "Dunnett"), base = >>> "placebo") >>> >>> The code base="placebo" is ignored. All treatments are compared to the >>> first treatment in the order, which is "high dose". It is possible to >>> rearrange the order so that "placebo' is first, but this is inconvenient. >>> >>> Thanks, >>> James F. Henson >>> >>> [[alternative HTML version deleted]] >>> >>> ______________________________________________ >>> 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. > > ______________________________________________ > 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.