transform                package:base                R Documentation

Transform an Object, for Example a Data Frame

Description:

     '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'.

Usage:

     transform(x, ...)

Arguments:

       x: The object to be transformed

     ...: Further arguments of the form 'tag=value'

Details:

     The '...' arguments to 'transform.data.frame' are tagged vector
     expressions, which are evaluated in the data frame 'x'.  The tags
     are matched against 'names(x)', and for those that match, the
     value replace the corresponding variable in 'x', and the others
     are appended to 'x'.

Value:

     The modified value of 'x'.

Note:

     If some of the values are not vectors of the appropriate length,
     you deserve whatever you get!

Author(s):

     Peter Dalgaard

See Also:

     'subset', 'list', 'data.frame'

Examples:

     data(airquality)
     transform(airquality, Ozone = -Ozone)
     transform(airquality, new = -Ozone, Temp = (Temp-32)/1.8)

     attach(airquality)
     transform(Ozone, logOzone = log(Ozone)) # marginally interesting ...
     detach(airquality)

