EVOLUTION-MANAGER
Edit File: mutate.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: Mutate a data frame by adding new or replacing existing...</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 mutate {plyr}"><tr><td>mutate {plyr}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Mutate a data frame by adding new or replacing existing columns.</h2> <h3>Description</h3> <p>This function is very similar to <code><a href="../../base/html/transform.html">transform</a></code> but it executes the transformations iteratively so that later transformations can use the columns created by earlier transformations. Like transform, unnamed components are silently dropped. </p> <h3>Usage</h3> <pre> mutate(.data, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>.data</code></td> <td> <p>the data frame to transform</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>named parameters giving definitions of new columns.</p> </td></tr> </table> <h3>Details</h3> <p>Mutate seems to be considerably faster than transform for large data frames. </p> <h3>See Also</h3> <p><code><a href="../../base/html/subset.html">subset</a></code>, <code><a href="summarise.html">summarise</a></code>, <code><a href="arrange.html">arrange</a></code>. For another somewhat different approach to solving the same problem, see <code><a href="../../base/html/with.html">within</a></code>. </p> <h3>Examples</h3> <pre> # Examples from transform mutate(airquality, Ozone = -Ozone) mutate(airquality, new = -Ozone, Temp = (Temp - 32) / 1.8) # Things transform can't do mutate(airquality, Temp = (Temp - 32) / 1.8, OzT = Ozone / Temp) # mutate is rather faster than transform system.time(transform(baseball, avg_ab = ab / g)) system.time(mutate(baseball, avg_ab = ab / g)) </pre> <hr /><div style="text-align: center;">[Package <em>plyr</em> version 1.8.7 <a href="00Index.html">Index</a>]</div> </body></html>