R: Combine or subset 'emmGrid' objects

rbind.emmGrid {emmeans} | R Documentation

## Combine or subset `emmGrid` objects

### Description

These 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.

### Usage

    ## 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, ...]

### Arguments

`...` | In `rbind`, object(s) of class `emmGrid`. In `"["`, it is ignored.
`deparse.level` | (required but not used)
`adjust` | Character value passed to `update.emmGrid`
`e1` | An `emmGrid` object
`e2` | Another `emmGrid` object
`x` | An `emmGrid` object to be subsetted
`i` | Integer vector of indexes
`drop.levels` | Logical value. If `TRUE`, the `"levels"` slot in the returned object is updated to hold only the predictor levels that actually occur

### Value

A revised object opf class `emmGrid`

The result of `e1 + e2` is the same as `rbind(e1, e2)`

### Note

`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.

### Examples

    warp.lm <- lm(breaks ~ wool * tension, data = warpbreaks)
    warp.rg <- ref_grid(warp.lm)

    # Show only 3 of the 6 cases
    summary(warp.rg[c(2,4,5)])

    # 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 abve except for adjustment

[Package emmeans version 1.1.3 Index]