summarise: Summary statistics for grouped data

Description Usage Arguments Methods (by class) Examples

View source: R/summarise.R

Description

Easily get summary statistics for each group present in the data

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
summarise(x, ...)

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

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

## S3 method for class '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)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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)

Hotelling documentation built on Sept. 9, 2021, 9:09 a.m.