sqlmodelmatrix: Create model matrix in a SQL table

Description Usage Arguments Details Value See Also Examples

Description

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

Usage

1
sqlmodelmatrix(formula, design, fullrank = TRUE)

Arguments

formula

model formula

design

sqlsurvey object

fullrank

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

Details

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.

Value

An object of class sqlmodelmatrix

See Also

link{open.sqlmodelmatrix} for reconnecting saved objects

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
mm <- sqlmodelmatrix(api00~stype*comp_imp+ell+api99, sqclus1)
dbGetQuery(sqclus1$conn,
     sqlsubst("select * from %%mm%% limit 2", list(mm=mm$table)))
head(mm)
dbListTables(sqclus1$conn)
rm(mm)
gc()
dbListTables(sqclus1$conn)
close(sqclus1)

## End(Not run)

sqlsurvey documentation built on May 2, 2019, 4:53 p.m.