| rbind.emmGrid | R Documentation |
emmGrid objectsThese functions provide methods for rbind and
[ that may be used to combine emmGrid objects
together, or to extract a subset of cases. The primary reason for
doing this would be to obtain multiplicity-adjusted results for smaller
or larger families of tests or confidence intervals.
## S3 method for class 'emmGrid'
rbind(..., deparse.level = 1, adjust = "bonferroni")
## S3 method for class 'emmGrid'
e1 + e2
## S3 method for class 'emmGrid'
x[i, adjust, drop.levels = TRUE, ...]
## S3 method for class 'emmGrid'
head(x, n = 6, ...)
## S3 method for class 'emmGrid'
tail(x, n = 6, ...)
## S3 method for class 'emmGrid'
subset(x, subset, ...)
## S3 method for class 'emm_list'
rbind(..., which, adjust = "bonferroni")
## S3 method for class 'summary_emm'
rbind(..., which)
force_regular(object)
... |
In |
deparse.level |
(required but not used) |
adjust |
Character value passed to |
e1, e2, x, object |
Objects of class |
i |
Integer vector of indexes |
drop.levels |
Logical value. If |
n |
integer number of entries to include (or exclude if negative) |
subset |
logical expression indicating which rows of the grid to keep |
which |
Integer vector of subset of elements to use; if missing, we use all elements. |
A revised object of class emmGrid
The result of e1 + e2 is the same as rbind(e1, e2)
The rbind method for emm_list objects simply combines
the emmGrid objects comprising the first element of ....
Note that the returned object is not yet summarized, so any adjust
parameters apply to the combined emmGrid.
The rbind method for summary_emm objects (or a list thereof)
returns a single summary_emm object. This combined object
preserves any adjusted P values or confidence limits in the
original summaries, since those quantities have already been computed.
force_regular adds extra (invisible) rows to an emmGrid object
to make it a regular grid (all combinations of factors). This regular structure is
needed by emmeans. An object can become irregular by, for example,
subsetting rows, or by obtaining contrasts of a nested structure.
rbind throws an error if there are incompatibilities in
the objects' coefficients, covariance structures, etc. But they
are allowed to have different factors; a missing level '.'
is added to factors as needed.
These functions generally reset by.vars to NULL;
so if you want to keep any “by” variables, you should follow-up
with update.emmGrid.
warp.lm <- lm(breaks ~ wool * tension, data = warpbreaks)
warp.rg <- ref_grid(warp.lm)
# Do all pairwise comparisons within rows or within columns,
# all considered as one faily of tests:
w.t <- pairs(emmeans(warp.rg, ~ wool | tension))
t.w <- pairs(emmeans(warp.rg, ~ tension | wool))
rbind(w.t, t.w, adjust = "mvt")
update(w.t + t.w, adjust = "fdr") ## same as above except for adjustment
# Show only 3 of the 6 cases
summary(warp.rg[c(2, 4, 5)])
# After-the-fact 'at' specification
subset(warp.rg, wool == "A") ## or warp.rg |> subset(wool == "A")
### Working with 'emm_list' objects
mod <- lm(conc ~ source + factor(percent), data = pigs)
all <- emmeans(mod, list(src = pairwise ~ source, pct = consec ~ percent))
rbind(all, which = c(2, 4), adjust = "mvt")
### Irregular object
tmp <- warp.rg[-1]
## emmeans(tmp, "tension") # will fail because tmp is irregular
emmeans(force_regular(tmp), "tension") # will show some results
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.