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)

