transform                package:base                R Documentation

_T_r_a_n_s_f_o_r_m _a_n _O_b_j_e_c_t, _f_o_r _E_x_a_m_p_l_e _a _D_a_t_a _F_r_a_m_e

_D_e_s_c_r_i_p_t_i_o_n:

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

_U_s_a_g_e:

     transform(`_data`, ...)

_A_r_g_u_m_e_n_t_s:

   _data: The object to be transformed

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

_D_e_t_a_i_l_s:

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

_V_a_l_u_e:

     The modified value of '_data'.

_N_o_t_e:

     Prior to R 2.3.0, the first argument was named 'x', but this
     caused trouble if people wanted to create a variable of that name.
     Names starting with an underscore are syntactically invalid, so
     the current choice should be less problematic.

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

_A_u_t_h_o_r(_s):

     Peter Dalgaard

_S_e_e _A_l_s_o:

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

_E_x_a_m_p_l_e_s:

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

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

