Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot.ls_means

Bar Plots of LS-Means


Description

Bar plots of LS-means using the ggplot2 package.

Usage

## S3 method for class 'ls_means'
plot(x, y = NULL, which = NULL, mult = TRUE, ...)

Arguments

x

an ls_means object.

y

not used and ignored with a warning.

which

optional character vector naming factors for which LS-means should be plotted. If NULL (default) plots for all LS-means are generated.

mult

if TRUE and there is more than one term for which to plot LS-means the plots are organized in panels with facet_wrap.

...

currently not used.

Value

generates the desired plots and invisibly returns the plot objects.

Author(s)

Rune Haubo B. Christensen

See Also

Examples

# Fit example model with 2 factors:
data("cake", package="lme4")
cake$Temp <- factor(cake$temperature, ordered = FALSE)
model <- lmer(angle ~ recipe * Temp + (1|recipe:replicate), cake)

# Extract LS-means:
(lsm <- ls_means(model))

# Multi-frame plot of the LS-means
plot(lsm)

# Compute list of 'single frame' plots:
res <- plot(lsm, mult=FALSE)

# Display each plot separately:
plot(res[[1]])
plot(res[[2]])

# Example with pairwise differences of LS-means:
(lsm <- ls_means(model, pairwise = TRUE))
plot(lsm, which="Temp")

lmerTest

Tests in Linear Mixed Effects Models

v3.1-3
GPL (>= 2)
Authors
Alexandra Kuznetsova [aut], Per Bruun Brockhoff [aut, ths], Rune Haubo Bojesen Christensen [aut, cre], Sofie Pødenphant Jensen [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.