EVOLUTION-MANAGER
Edit File: transform.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: Transform an Object, for Example 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 transform {base}"><tr><td>transform {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Transform an Object, for Example a Data Frame</h2> <h3>Description</h3> <p><code>transform</code> is a generic function, which—at least currently—only does anything useful with data frames. <code>transform.default</code> converts its first argument to a data frame if possible and calls <code>transform.data.frame</code>. </p> <h3>Usage</h3> <pre> transform(`_data`, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>_data</code></td> <td> <p>The object to be transformed</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>Further arguments of the form <code>tag=value</code></p> </td></tr> </table> <h3>Details</h3> <p>The <code>...</code> arguments to <code>transform.data.frame</code> are tagged vector expressions, which are evaluated in the data frame <code>_data</code>. The tags are matched against <code>names(_data)</code>, and for those that match, the value replace the corresponding variable in <code>_data</code>, and the others are appended to <code>_data</code>. </p> <h3>Value</h3> <p>The modified value of <code>_data</code>. </p> <h3>Warning</h3> <p>This is a convenience function intended for use interactively. For programming it is better to use the standard subsetting arithmetic functions, and in particular the non-standard evaluation of argument <code>transform</code> can have unanticipated consequences. </p> <h3>Note</h3> <p>If some of the values are not vectors of the appropriate length, you deserve whatever you get! </p> <h3>Author(s)</h3> <p>Peter Dalgaard</p> <h3>See Also</h3> <p><code><a href="with.html">within</a></code> for a more flexible approach, <code><a href="subset.html">subset</a></code>, <code><a href="list.html">list</a></code>, <code><a href="data.frame.html">data.frame</a></code> </p> <h3>Examples</h3> <pre> transform(airquality, Ozone = -Ozone) transform(airquality, new = -Ozone, Temp = (Temp-32)/1.8) attach(airquality) transform(Ozone, logOzone = log(Ozone)) # marginally interesting ... detach(airquality) </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>