You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can two analysis in the function surv_timepoint: surv and surv_diff. And we can also choose both in the method parameter.
library(tern)
library(scda)
library(dplyr)
adsl <- synthetic_cdisc_dataset("latest", "adsl")
adtte <- synthetic_cdisc_dataset("latest", "adtte")
# Ensure that character variables are converted to factors and empty strings and NAs are explicit missing levels.
adsl <- df_explicit_na(adsl)
adtte <- df_explicit_na(adtte)
adtte_f <- adtte %>%
dplyr::filter(PARAMCD == "OS") %>%
dplyr::mutate(
AVAL = day2month(AVAL),
is_event = CNSR == 0,
is_not_event = CNSR == 1,
EVNTDESC = factor(EVNTDESC)
)
lyt <- basic_table(show_colcounts = TRUE) %>%
split_cols_by(
var = "ARM", ref_group = "A: Drug X"
) %>%
summarize_vars(
vars = "is_event",
.stats = "count_fraction",
.labels = c(count_fraction = "Patients with event (%)")
) %>%
summarize_vars(
vars = "is_not_event",
.stats = "count_fraction",
.labels = c(count_fraction = "Patients without event (%)"),
nested = FALSE,
show_labels = "hidden"
) %>%
surv_timepoint(
vars = "AVAL",
var_labels = "Months",
time_point = c(6, 12),
is_event = "is_event",
method = "surv",
control = control_surv_timepoint()
) %>%
surv_timepoint(
vars = "AVAL",
var_labels = "Months",
time_point = c(6, 12),
is_event = "is_event",
method = "surv_diff",
control = control_surv_timepoint()
) %>%
surv_timepoint(
vars = "AVAL",
var_labels = "Months",
time_point = c(6, 12),
is_event = "is_event",
method = "both",
control = control_surv_timepoint()
)
result <- build_table(lyt, df = adtte_f, alt_counts_df = adsl)
result
The layout looks like below, When I run the surv_timepoint function with each single method, it works well with correct indention. But failed to align indention when we choose both.
A: Drug X B: Placebo C: Combination
(N=134) (N=134) (N=132)
————————————————————————————————————————————————————————————————————————————————————
Patients with event (%) 79 (59%) 87 (64.9%) 116 (87.9%)
Patients without event (%) 55 (41%) 47 (35.1%) 16 (12.1%)
6 Months
Patients remaining at risk 106 112 92
Event Free Rate (%) 83.83 89.16 73.40
95% CI (77.49, 90.17) (83.80, 94.53) (65.72, 81.07)
12 Months
Patients remaining at risk 92 83 56
Event Free Rate (%) 78.03 70.32 46.39
95% CI (70.82, 85.24) (62.27, 78.37) (37.59, 55.18)
6 Months
Difference in Event Free Rate 5.33 -10.43
95% CI (-2.97, 13.64) (-20.38, -0.48)
p-value (Z-test) 0.2080 0.0399
12 Months
Difference in Event Free Rate -7.71 -31.64
95% CI (-18.51, 3.10) (-43.01, -20.26)
p-value (Z-test) 0.1622 <0.0001
6 Months
Patients remaining at risk 106 112 92
Event Free Rate (%) 83.83 89.16 73.40
95% CI (77.49, 90.17) (83.80, 94.53) (65.72, 81.07)
Difference in Event Free Rate 5.33 -10.43
95% CI (-2.97, 13.64) (-20.38, -0.48)
p-value (Z-test) 0.2080 0.0399
12 Months
Patients remaining at risk 92 83 56
Event Free Rate (%) 78.03 70.32 46.39
95% CI (70.82, 85.24) (62.27, 78.37) (37.59, 55.18)
Difference in Event Free Rate -7.71 -31.64
95% CI (-18.51, 3.10) (-43.01, -20.26)
p-value (Z-test) 0.1622 <0.0001
Code of Conduct
I agree to follow this project's Code of Conduct.
Contribution Guidelines
I agree to follow this project's Contribution Guidelines.
Security Policy
I agree to follow this project's Security Policy.
The text was updated successfully, but these errors were encountered:
Feature description
We can two analysis in the function
surv_timepoint
:surv
andsurv_diff
. And we can also chooseboth
in themethod
parameter.The layout looks like below, When I run the
surv_timepoint
function with each single method, it works well with correct indention. But failed to align indention when we chooseboth
.Code of Conduct
Contribution Guidelines
Security Policy
The text was updated successfully, but these errors were encountered: