ChangeSvyTable: ChangeSvyTable: Modify the number n

View source: R/svyCreateTableOneJS.R

ChangeSvyTableR Documentation

ChangeSvyTable: Modify the number n

Description

Replace the number of weights taken into account with the number of n in the original data

Usage

ChangeSvyTable(svy, ori)

Arguments

svy

TableOne object that take weights into account

ori

TableOne object in the original data

Details

DETAILS

Value

A matrix that replaces the n number of weights with the n number of the original data

Examples

# 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)

jstable documentation built on April 12, 2025, 1:22 a.m.