library(survival)
library(dplyr)
lung %>%
mutate(
status = as.integer(status == 1),
sex = factor(sex),
kk = factor(as.integer(pat.karno >= 70)),
kk1 = factor(as.integer(pat.karno >= 60))
) -> lung
TableSubgroupMultiGLM(status ~ sex,
var_subgroups = c("kk", "kk1"),
data = lung, line = TRUE, family = "binomial"
)
## survey design
library(survey)
data.design <- svydesign(id = ~1, data = lung)
TableSubgroupMultiGLM(status ~ sex,
var_subgroups = c("kk", "kk1"),
data = data.design, family = "binomial"
)
Run the code above in your browser using DataLab