Summarise a data frame.
summarise(.data, ...)
.data |
the data frame to be summarised |
... |
further arguments of the form var = value |
Be careful when using existing variable names; the corresponding columns will be immediately updated with the new data and this can affect subsequent operations referring to those variables.
# Let's extract the number of teams and total period of time # covered by the baseball dataframe summarise(baseball, duration = max(year) - min(year), nteams = length(unique(team))) # Combine with ddply to do that for each separate id ddply(baseball, "id", summarise, duration = max(year) - min(year), nteams = length(unique(team)))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.