Skip to content

Commit

Permalink
reverting indent
Browse files Browse the repository at this point in the history
  • Loading branch information
Melkiades committed Jun 1, 2023
1 parent 5d6b027 commit b6c3818
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 63 deletions.
1 change: 0 additions & 1 deletion R/survival_timepoint.R
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ surv_timepoint <- function(lyt,
var_labels = paste(tpt, var_labels),
table_names = paste0("surv_diff_", tpt, table_names_suffix),
show_labels = ifelse(method == "both", "hidden", show_labels),
indent_mod = ifelse(method == "both", 1L, 0L),
afun = afun_surv_diff,
extra_args = list(
is_event = list(...)$is_event,
Expand Down
62 changes: 0 additions & 62 deletions tests/testthat/test-survival_timepoint.R
Original file line number Diff line number Diff line change
Expand Up @@ -238,65 +238,3 @@ testthat::test_that("surv_timepoint works with method = both", {
testthat::expect_snapshot(res)
})

testthat::test_that("surv_timepoint has proper indentation", {
# This is a regression test from tern#936
adtte_f <- tern_ex_adtte %>%
dplyr::filter(PARAMCD == "OS") %>%
dplyr::mutate(
AVAL = day2month(AVAL),
is_event = CNSR == 0,
is_not_event = CNSR == 1
)
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"
# The following creates an error: .indent_mods = 1L (TODO: check this)
) %>%
surv_timepoint(
vars = "AVAL",
var_labels = "Months",
time_point = c(6, 12),
is_event = "is_event",
method = "surv",
table_names_suffix = "1",
control = control_surv_timepoint(),
.indent_mods = 1L
) %>%
surv_timepoint(
vars = "AVAL",
var_labels = "Months",
time_point = c(6, 12),
is_event = "is_event",
method = "surv_diff",
table_names_suffix = "2",
control = control_surv_timepoint(),
.indent_mods = 1L
) %>%
surv_timepoint(
vars = "AVAL",
var_labels = "Months",
time_point = c(6, 12),
is_event = "is_event",
method = "both",
table_names_suffix = "3",
control = control_surv_timepoint(),
.indent_mods = 1L # These do nothing atm (TODO: fix this behavior)
)

result <- build_table(lyt, df = adtte_f, alt_counts_df = tern_ex_adsl)

testthat::expect_snapshot(make_row_df(result)$indent)
testthat::expect_snapshot(result[c(1:5, nrow(result) - 9:1), 1])
})

0 comments on commit b6c3818

Please sign in to comment.