svydbtable: Survey Tables

Description Usage Arguments Author(s) See Also Examples

View source: R/svydbtable.R

Description

Create contingency tables for survey data sets.

Usage

1
svydbtable(formula, design, as.local = F)

Arguments

formula

A formula specifying margins for the table, only + can be used.

design

svydb.design object.

as.local

A logical value indicating the returning object type. Default is database tables, tbl_sql if the input is tbl_sql.

Author(s)

Charco Hui

See Also

svydbdesign

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(nhane)
nh.dbsurv = svydbdesign(st = SDMVSTRA, wt = WTMEC2YR,id = SDMVPSU, data = nhane)
svydbtable(~Race3 + Smoke100 + Gender, nh.dbsurv)
svydbtable(~MaritalStatus, design = nh.dbsurv, as.local = T)
# OR with a database connection
# library(MonetDBLite)
# library(DBI)
# library(dbplyr)
# con = dbConnect(MonetDBLite())
# dbWriteTable(con, "nhane", nhane)
# nhane.db = tbl(con, "nhane")
# nh.dbsurv = svydbdesign(st = SDMVSTRA, wt = WTMEC2YR, id = SDMVPSU, data = nhane.db)

chrk623/svydb documentation built on Oct. 6, 2019, 6:54 a.m.