Learn R Programming

Hotelling (version 1.0-8)

summarise: Summary statistics for grouped data

Description

Easily get summary statistics for each group present in the data

Usage

summarise(x, ...)

# S3 method for default summarise( x, y, stats = list(Mean = mean, Median = median, `Std. Dev.` = sd, N = length), ... )

# S3 method for formula summarise( x, data = NULL, stats = list(Mean = mean, Median = median, `Std. Dev.` = sd, N = length), ... )

# S3 method for data.frame summarise(x, y, ...)

Arguments

x

a matrix of multivariate observations, a list of summary statistics from multivariate observations, a data.frame of multivariate observations, or a formula with a multivariate response on the right hand side, and a grouping variable/factor on the left hand side.

y

a matrix of multivariate observations, a list of summary statistics from multivariate observations, OR a data.frame of multivariate observations

stats

a named list of summary statistics to compute on each variable in each group. Note 1: Quantiles are not supported yet because I can't think of a good way to handle the extra arguments. Help welcome. Note 2: The names of the elements in the list are used to label the columns of the output. They probably should be unique.

data

a data.frame containing the variables used in a formula

other arguments such as another matrix of multivariate observations: see summarise.default, or a data to be used with a formula: see summarise.formula

Methods (by class)

  • default: Summary statistics for grouped data

  • formula: Summary statistics for grouped data

  • data.frame: Summary statistics for grouped data

Examples

Run this code
# NOT RUN {
data(container.df)
split.data = split(container.df[,-1],container.df$gp)
x = split.data[[1]]
y = split.data[[2]]
summarise(x, y)

## Using the formula interface
data(container.df)
summarise(gp~., data = container.df)

summarise(gp~Al+Ti, data = container.df)

# }

Run the code above in your browser using DataLab