EVOLUTION-MANAGER
Edit File: summarise.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Summarise a data frame.</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for summarise {plyr}"><tr><td>summarise {plyr}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Summarise a data frame.</h2> <h3>Description</h3> <p>Summarise works in an analogous way to <code><a href="mutate.html">mutate</a></code>, except instead of adding columns to an existing data frame, it creates a new data frame. This is particularly useful in conjunction with <code><a href="ddply.html">ddply</a></code> as it makes it easy to perform group-wise summaries. </p> <h3>Usage</h3> <pre> summarise(.data, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>.data</code></td> <td> <p>the data frame to be summarised</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>further arguments of the form var = value</p> </td></tr> </table> <h3>Note</h3> <p>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. </p> <h3>Examples</h3> <pre> # 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))) </pre> <hr /><div style="text-align: center;">[Package <em>plyr</em> version 1.8.7 <a href="00Index.html">Index</a>]</div> </body></html>