View source: R/svyCreateTableOneJS.R
ChangeSvyTable | R Documentation |
Replace the number of weights taken into account with the number of n in the original data
ChangeSvyTable(svy, ori)
svy |
TableOne object that take weights into account |
ori |
TableOne object in the original data |
DETAILS
A matrix that replaces the n number of weights with the n number of the original data
# example code
library('survey'); library('tableone')
data(nhanes)
nhanes$SDMVPSU <- as.factor(nhanes$SDMVPSU)
nhanesSvy <- svydesign(
ids = ~SDMVPSU, strata = ~SDMVSTRA, weights = ~WTMEC2YR,
nest = TRUE, data = nhanes
)
res <- svyCreateTableOne(
vars = c("HI_CHOL", "race", "agecat", "RIAGENDR"),
strata = "RIAGENDR", data = nhanesSvy,
factorVars = c("HI_CHOL", "race", "RIAGENDR")
)
ori <- CreateTableOne(
vars = c("HI_CHOL", "race", "agecat", "RIAGENDR"),
strata = "RIAGENDR", data = nhanes,
factorVars = c("HI_CHOL", "race", "RIAGENDR")
)
ChangeSvyTable(res, ori)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.