gsummary

0th

Percentile

Summarize a data frame by group

Provide a summary of the variables in a data frame by groups of rows.

Keywords
manip, methods
Usage
gsummary(object, FUN, form, level, groups, omitGroupingFactor = FALSE, invariantsOnly = FALSE, ...)
Arguments
object
an object to be summarized - usually a data.frame
FUN
an optional summary function or a list of summary functions to be applied to each variable in the frame. The function or functions are applied only to variables in object that vary within the groups defined by groups.
omitGroupingFactor
an optional logical value. When TRUE the grouping factor itself will be omitted from the group-wise summary but the levels of the grouping factor will continue to be used as the row names for the data frame that is produced by the
form
an optional one-sided formula that defines the groups. When this formula is given, the right-hand side is evaluated in object, converted to a factor if necessary, and the unique levels are used to define the groups. Defaults to <
level
an optional positive integer giving the level of grouping to be used in an object with multiple nested grouping levels. Defaults to the highest or innermost level of grouping.
groups
an optional factor that will be used to split the rows into groups. Defaults to getGroups(object, form, level).
invariantsOnly
an optional logical value. When TRUE only those covariates that are invariant within each group will be summarized. The summary value for the group is always the unique value taken on by that covariate within the group. The colum
...
optional additional arguments to the summary functions that are invoked on the variables by group. Often it is helpful to specify na.rm = TRUE.
Value

  • A data.frame with one row for each level of the grouping factor. The number of columns is at most the number of columns in object.

See Also

summary

Aliases
  • gsummary
  • gsummary-methods
  • gsummary,data.frame,ANY,ANY,ANY,factor-method
Examples
ChickWeight <- do.call("data.frame", ChickWeight)
class(ChickWeight)
gsummary(ChickWeight, groups = ChickWeight$Chick)
gsummary(ChickWeight, groups = ChickWeight$Chick,
          invariantsOnly = TRUE)
Documentation reproduced from package lme4, version 0.99875-8, License: GPL version 2 or later

Community examples

Looks like there are no examples yet.