-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: "label_all" dose not work in tabulate_survival_subgroups()
#1231
Comments
Hi @fenguoerbian, Sorry for the confusion in the documentation (I'll update it accordingly), the library(dplyr)
library(forcats)
library(tern)
adtte <- tern_ex_adtte
# Save variable labels before data processing steps.
adtte_labels <- formatters::var_labels(adtte)
adtte_f <- adtte %>%
filter(
PARAMCD == "OS",
ARM %in% c("B: Placebo", "A: Drug X"),
SEX %in% c("M", "F")
) %>%
mutate(
# Reorder levels of ARM to display reference arm before treatment arm.
ARM = droplevels(fct_relevel(ARM, "B: Placebo")),
SEX = droplevels(SEX),
AVALU = as.character(AVALU),
is_event = CNSR == 0
)
labels <- c(
"ARM" = adtte_labels[["ARM"]],
"SEX" = adtte_labels[["SEX"]],
"AVALU" = adtte_labels[["AVALU"]],
"is_event" = "Event Flag"
)
formatters::var_labels(adtte_f)[names(labels)] <- labels
df <- extract_survival_subgroups(
variables = list(
tte = "AVAL",
is_event = "is_event",
arm = "ARM", subgroups = c("SEX", "BMRKR2")
),
data = adtte_f,
label_all = "Full Analysis Set"
)
df_grouped <- extract_survival_subgroups(
variables = list(
tte = "AVAL",
is_event = "is_event",
arm = "ARM", subgroups = c("SEX", "BMRKR2")
),
data = adtte_f,
groups_lists = list(
BMRKR2 = list(
"low" = "LOW",
"low/medium" = c("LOW", "MEDIUM"),
"low/medium/high" = c("LOW", "MEDIUM", "HIGH")
)
),
label_all = "Full Analysis Set"
)
## Table with default columns.
basic_table() %>%
tabulate_survival_subgroups(df, time_unit = adtte_f$AVALU[1])
#> B: Placebo A: Drug X
#> Baseline Risk Factors Total Events Events Median (DAYS) Events Median (DAYS) Hazard Ratio 95% Wald CI
#> ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
#> Full Analysis Set 101 57 727.8 44 974.6 0.71 (0.48, 1.06)
#> Sex
#> F 55 31 599.2 24 1016.3 0.56 (0.32, 0.96)
#> M 46 26 888.5 20 974.6 0.91 (0.50, 1.65)
#> Continuous Level Biomarker 2
#> LOW 36 21 735.5 15 974.6 0.76 (0.39, 1.51)
#> MEDIUM 31 14 731.8 17 964.2 0.77 (0.36, 1.61)
#> HIGH 34 22 654.8 12 1016.3 0.67 (0.33, 1.36) Created on 2024-04-19 with reprex v2.1.0 |
Thanks a lot! |
edelarua
added a commit
that referenced
this issue
Apr 23, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What happened?
Change
label_all
intabulate_survival_subgroups()
will not have any actual effect on the resulting table.example from
tabulate_survival_subgroups()
's documentation. One can see that the resulting table still has "All Patients", not "Full Analysis Set" in the first row.sessionInfo()
Relevant log output
No response
Code of Conduct
Contribution Guidelines
Security Policy
The text was updated successfully, but these errors were encountered: