| transform | R Documentation |
transform is a generic function, which—at leastcurrently—only does anything useful withdata frames.transform.default converts its first argument toa data frame if possible and callstransform.data.frame.
transform(`_data`, ...)
_data | The object to be transformed |
... | Further arguments of the form |
The... arguments totransform.data.frame are taggedvector expressions, which are evaluated in the data frame_data. The tags are matched againstnames(_data), and forthose that match, the value replace the corresponding variable in_data, and the others are appended to_data.
The modified value of_data.
This is a convenience function intended for use interactively. Forprogramming it is better to use the standard subsetting arithmetic functions,and in particular the non-standard evaluation ofargumenttransform can have unanticipated consequences.
If some of the values are not vectors of the appropriate length,you deserve whatever you get!
Peter Dalgaard
within for a more flexible approach,subset,list,data.frame
transform(airquality, Ozone = -Ozone)transform(airquality, new = -Ozone, Temp = (Temp-32)/1.8)attach(airquality)transform(Ozone, logOzone = log(Ozone)) # marginally interesting ...detach(airquality)
Add the following code to your website.
For more information on customizing the embed code, readEmbedding Snippets.
