sqlmodelmatrix           package:surveyNG           R Documentation

_C_r_e_a_t_e _m_o_d_e_l _m_a_t_r_i_x _i_n _a _S_Q_L _t_a_b_l_e

_D_e_s_c_r_i_p_t_i_o_n:

     Given a formula and a 'sqlsurvey' design object, create SQL tables
     with a model frame and model matrix.

_U_s_a_g_e:

     sqlmodelmatrix(formula, design, fullrank = TRUE)

_A_r_g_u_m_e_n_t_s:

 formula: model formula

  design: 'sqlsurvey' object

fullrank: if 'FALSE' return a matrix of indicators for any factor
          variables, not a full-rank design matrix 

_D_e_t_a_i_l_s:

     Currently, no transformations are allowed in the formula, factors
     will be coded with treatment contrasts, and interactions are
     allowed only between factor variables.

     The database tables created by this function will be removed if
     the R object is deleted and garbage collected.

_V_a_l_u_e:

     An object of class 'sqlmodelmatrix'

_S_e_e _A_l_s_o:

     'link{open.sqlmodelmatrix}' for reconnecting saved objects

_E_x_a_m_p_l_e_s:

     sqclus1<-sqlsurvey(id="dnum", fpc="fpc", weights="pw", strata="fpc",
        data=system.file("apiclus1.db",package="surveyNG"),
        table.name="clus1", key="snum")
     mm <- sqlmodelmatrix(api00~stype*comp_imp+ell+api99, sqclus1)
     dbGetQuery(sqclus1$conn,
          sqlsubst("select * from %%mm%% limit 2", list(mm=mm$table)))
     dbListTables(sqclus1$conn)
     rm(mm)
     gc()
     dbListTables(sqclus1$conn)
     close(sqclus1)

