Learn R Programming

plyr (version 1.5.2)

summarise: Summarise a data frame.

Description

Summarise a data frame.

Usage

summarise(.data, ...)

Arguments

.data
the data frame to be summarised
...
further arguments of the form var = value

Details

Summarise works in an analagous way to transform, except instead of adding columns to an existing data frame, it creates a new one. This is particularly useful in conjunction with ddply as it makes it easy to perform group-wise summaries.

Examples

Run this code
summarise(baseball, 
duration = max(year) - min(year), 
nteams = length(unique(team)))
ddply(baseball, "id", summarise, 
duration = max(year) - min(year), 
nteams = length(unique(team)))

Run the code above in your browser using DataLab