View source: R/aggregateFrame.R
aggregateFrame | R Documentation |
Splits the data into subsets, computes summary statistics for each numerical variable, and returns the result in a convenient form.
aggregateFrame(data, by, compute, na.rm)
data |
A data frame |
by |
grouping elements,as long as the variables in the data frame data. |
compute |
A function to compute the summary statistics which can be applied to all numerical data subsets |
na.rm |
logical. Should missing values be removed |
For non-numerical variables, the function returns the alphabetically smallest value.
An aggregated data frame.
T. Ruf
aggregate
data(CO2)
aggregateFrame(CO2,CO2$Type,compute="median", na.rm=T)
comb=paste(CO2$Plant, CO2$Type)
aggregateFrame(CO2,comb,compute="min", na.rm=F)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.