Description Usage Arguments Details Value Warning Note Author(s) See Also Examples
transform
is a generic function, which—at least
currently—only does anything useful with
data frames. transform.default
converts its first argument to
a data frame if possible and calls transform.data.frame
.
1 |
_data |
The object to be transformed |
... |
Further arguments of the form |
The ...
arguments to transform.data.frame
are tagged
vector expressions, which are evaluated in the data frame
_data
. The tags are matched against names(_data)
, and for
those 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. For
programming it is better to use the standard subsetting arithmetic functions,
and in particular the non-standard evaluation of
argument transform
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
1 2 3 4 5 6 | 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, read Embedding Snippets.