# Example using the ovarian data set
survival::ovarian %>%
dplyr::select(-fustat) %>%
dplyr::mutate(
age_group = factor(
dplyr::case_when(
age <= 50 ~ "<= 50 years",
age <= 60 ~ "<= 60 years",
age <= 70 ~ "<= 70 years",
TRUE ~ "> 70 years"
)
),
rx = factor(rx),
ecog.ps = factor(ecog.ps)
) %>%
dplyr::select(age, age_group, everything()) %>%
visR::get_tableone()
# Examples using ADaM data
# display patients in an analysis set
adtte %>%
dplyr::filter(SAFFL == "Y") %>%
dplyr::select(TRTA) %>%
visR::get_tableone()
## display overall summaries for demog
adtte %>%
dplyr::filter(SAFFL == "Y") %>%
dplyr::select(AGE, AGEGR1, SEX, RACE) %>%
visR::get_tableone()
## By actual treatment
adtte %>%
dplyr::filter(SAFFL == "Y") %>%
dplyr::select(AGE, AGEGR1, SEX, RACE, TRTA) %>%
visR::get_tableone(strata = "TRTA")
## By actual treatment, without overall
adtte %>%
dplyr::filter(SAFFL == "Y") %>%
dplyr::select(AGE, AGEGR1, SEX, EVNTDESC, TRTA) %>%
visR::get_tableone(strata = "TRTA", overall = FALSE)
Run the code above in your browser using DataLab