get.var                 package:mgcv                 R Documentation

_G_e_t _n_a_m_e_d _v_a_r_i_a_b_l_e _o_r _e_v_a_l_u_a_t_e _e_x_p_r_e_s_s_i_o_n _f_r_o_m _l_i_s_t _o_r _d_a_t_a._f_r_a_m_e

_D_e_s_c_r_i_p_t_i_o_n:

     This routine takes a text string and a data frame or list. It
     first sees if the  string is the name of a variable in the data
     frame/ list. If it is then the value of this variable is returned.
      Otherwise the routine tries to evaluate the expression within the
     data.frame/list (but nowhere else) and if  successful returns the
     result. If neither step works then 'NULL' is returned. The routine
     is useful for processing gam formulae.

_U_s_a_g_e:

      get.var(txt,data)

_A_r_g_u_m_e_n_t_s:

     txt: a text string which is either the name of a variable in
          'data' or when  parsed is an expression that can be evaluated
          in 'data'. It can also be neither in which case the function
          returns 'NULL'.

    data: A data frame or list.

_V_a_l_u_e:

     The evaluated variable, or 'NULL'

_A_u_t_h_o_r(_s):

     Simon N. Wood simon.wood@r-project.org

_R_e_f_e_r_e_n_c_e_s:

     <URL: http://www.stats.gla.ac.uk/~simon/>

_S_e_e _A_l_s_o:

     'gam '

_E_x_a_m_p_l_e_s:

     y <- 1:4;dat<-data.frame(x=5:10)
     get.var("x",dat)
     get.var("y",dat)
     get.var("x==6",dat)

