summarise {plyr}R Documentation

Summarise a data frame.

Description

Create a new data frame that summarises an existing 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.

Author(s)

Hadley Wickham <h.wickham@gmail.com>

Examples

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

[Package plyr version 0.1.9 Index]