tabmulti.svy {tab} | R Documentation |
Create Table Comparing Characteristics Across Levels of a Categorical Variable (for Complex Survey Data)
Description
Creates a table comparing multiple characteristics (e.g. median age, mean
BMI, and race/ethnicity distribution) across levels of x
.
Usage
tabmulti.svy(
formula = NULL,
design,
xvarname = NULL,
yvarnames = NULL,
ymeasures = NULL,
columns = c("xgroups", "p"),
listwise.deletion = FALSE,
sep.char = ", ",
xlevels = NULL,
yvarlabels = NULL,
ylevels = NULL,
decimals = NULL,
formatp.list = NULL,
n.headings = FALSE,
N.headings = FALSE,
kable = TRUE,
tabmeans.svy.list = NULL,
tabmedians.svy.list = NULL,
tabfreq.svy.list = NULL
)
Arguments
formula |
Formula, e.g. |
design |
Survey design object from |
xvarname |
Character string with name of column variable. Should be one
of |
yvarnames |
Character vector with names of row variables. Each element
should be one of |
ymeasures |
Character vector specifying whether each |
columns |
Character vector specifying what columns to include. Choices
for each element are |
listwise.deletion |
Logical value for whether observations with missing
values for any |
sep.char |
Character string with separator to place between lower and
upper bound of confidence intervals. Typically |
xlevels |
Character vector with labels for the levels of |
yvarlabels |
Named list specifying labels for certain |
ylevels |
Character vector (if only 1 frequency comparison) or list of
character vectors with labels for the levels of each categorical |
decimals |
Numeric vector specifying number of decimal places for
numbers other than p-values for each |
formatp.list |
List of arguments to pass to |
n.headings |
Logical value for whether to display unweighted sample sizes in parentheses in column headings. |
N.headings |
Logical value for whether to display weighted sample sizes in parentheses in column headings. |
kable |
Logical value for whether to return a
|
tabmeans.svy.list |
List of arguments to pass to
|
tabmedians.svy.list |
List of arguments to pass to
|
tabfreq.svy.list |
List of arguments to pass to
|
Details
Basically tabmulti
for complex survey data. Relies heavily on
the survey package.
Value
kable
or character matrix.
Examples
# Create survey design object
library("survey")
design <- svydesign(
data = tabsvydata,
ids = ~sdmvpsu,
strata = ~sdmvstra,
weights = ~wtmec2yr,
nest = TRUE
)
# Compare age, race, and BMI by sex
tabmulti.svy(Age + Race + BMI ~ Sex, design)