collapse.groupedData {nlme} | R Documentation |
If object
has a single grouping factor, it is returned
unchanged. Else, it is summarized by the values of the
displayLevel
grouping factor (or the combination of its values
and the values of the covariate indicated in preserve
, if any is
present). The collapsed data is used to produce a new
groupedData
object, with grouping factor given by the
displayLevel
factor.
## S3 method for class 'groupedData' collapse(object, collapseLevel, displayLevel, outer, inner, preserve, FUN, subset, ...)
object |
an object inheriting from class |
collapseLevel |
an optional positive integer or character string indicating the grouping level to use when collapsing the data. Level values increase from outermost to innermost grouping. Default is the highest or innermost level of grouping. |
displayLevel |
an optional positive integer or character string
indicating the grouping level to use as the grouping factor for the
collapsed data. Default is |
outer |
an optional logical value or one-sided formula,
indicating covariates that are outer to the |
inner |
an optional logical value or one-sided formula, indicating
a covariate that is inner to the |
preserve |
an optional one-sided formula indicating a covariate
whose levels should be preserved when collapsing the data according
to the |
FUN |
an optional summary function or a list of summary functions
to be used for collapsing the data. The function or functions are
applied only to variables in |
subset |
an optional named list. Names can be either positive
integers representing grouping levels, or names of grouping
factors. Each element in the list is a vector indicating the levels
of the corresponding grouping factor to be preserved in the collapsed
data. Default is |
... |
some methods for this generic require additional arguments. None are used in this method. |
a groupedData
object with a single grouping factor given by the
displayLevel
grouping factor, resulting from collapsing
object
over the levels of the collapseLevel
grouping
factor.
José Pinheiro and Douglas Bates bates@stat.wisc.edu
groupedData
, plot.nmGroupedData
# collapsing by Dog collapse(Pixel, collapse = 1) # same as collapse(Pixel, collapse = "Dog")