Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
edelarua committed Sep 19, 2022
1 parent 402dc4b commit 261f93c
Showing 1 changed file with 25 additions and 54 deletions.
79 changes: 25 additions & 54 deletions tests/testthat/test-tm_t_exposure.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,15 @@ testthat::test_that("template_exposure generates correct expressions with defaul
}),
layout_prep = quote(split_fun <- drop_split_levels),
layout = quote(
lyt <- rtables::basic_table(main_footer = "* Patient time is the sum of TDURD") %>%
rtables::split_cols_by("SEX") %>%
rtables::add_colcounts() %>%
summarize_patients_exposure_in_cols(
var = "AVAL",
col_split = TRUE,
.labels = c(
n_patients = "Patient time*",
sum_exposure = paste("Sum of", "TDURD", sprintf("(%s)", "Days"))
)
) %>%
rtables::split_rows_by(
"RACE",
label_pos = "topleft",
split_fun = split_fun,
lyt <- rtables::basic_table(main_footer = "* Patient Time is the sum of TDURD") %>%
rtables::split_cols_by("SEX") %>% rtables::add_colcounts() %>%
summarize_patients_exposure_in_cols(var = "AVAL", col_split = TRUE,
.labels = c(n_patients = "Number of Patients", sum_exposure = paste("Sum of",
"TDURD", sprintf("(%s)", "Days"))), custom_label = "Total Number of Patients and Patient Time*") %>%
rtables::split_rows_by("RACE", label_pos = "topleft", split_fun = split_fun,
split_label = formatters::var_labels(adex["RACE"], fill = TRUE),
nested = FALSE
) %>%
summarize_patients_exposure_in_cols(var = "AVAL", col_split = FALSE)
nested = FALSE) %>% summarize_patients_exposure_in_cols(var = "AVAL",
col_split = FALSE)
),
table = quote({
result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl)
Expand Down Expand Up @@ -68,25 +58,16 @@ testthat::test_that("template_exposure generates correct expressions with custom
}),
layout_prep = quote(split_fun <- drop_split_levels),
layout = quote(
lyt <- rtables::basic_table(main_footer = "* Patient time is the sum of myTDURD") %>%
rtables::split_cols_by("SEX") %>%
rtables::add_colcounts() %>%
summarize_patients_exposure_in_cols(
var = "myAVAL",
col_split = TRUE,
.labels = c(
n_patients = "Patient time*",
sum_exposure = paste("Sum of", "myTDURD", sprintf("(%s)", "Days"))
lyt <- rtables::basic_table(main_footer = "* Patient Time is the sum of myTDURD") %>%
rtables::split_cols_by("SEX") %>% rtables::add_colcounts() %>%
summarize_patients_exposure_in_cols(var = "myAVAL", col_split = TRUE,
.labels = c(n_patients = "Number of Patients", sum_exposure = paste("Sum of",
"myTDURD", sprintf("(%s)", "Days"))), custom_label = "Total Number of Patients and Patient Time*") %>%
rtables::split_rows_by("myRACE", label_pos = "topleft", split_fun = split_fun,
split_label = formatters::var_labels(myadex["myRACE"],
fill = TRUE), nested = FALSE) %>% summarize_patients_exposure_in_cols(var = "myAVAL",
col_split = FALSE
)
) %>%
rtables::split_rows_by(
"myRACE",
label_pos = "topleft",
split_fun = split_fun,
split_label = formatters::var_labels(myadex["myRACE"], fill = TRUE),
nested = FALSE
) %>%
summarize_patients_exposure_in_cols(var = "myAVAL", col_split = FALSE)
),
table = quote({
result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = myadsl)
Expand Down Expand Up @@ -118,25 +99,15 @@ testthat::test_that("template_exposure generates correct expressions with paramc
}),
layout_prep = quote(split_fun <- drop_split_levels),
layout = quote(
lyt <- rtables::basic_table(main_footer = "* Patient time is the sum of Total Duration (Days)") %>%
rtables::split_cols_by("SEX") %>%
rtables::add_colcounts() %>%
summarize_patients_exposure_in_cols(
var = "AVAL",
col_split = TRUE,
.labels = c(
n_patients = "Patient time*",
sum_exposure = paste("Sum of", "TDURD", sprintf("(%s)", "Days"))
)
) %>%
rtables::split_rows_by(
"RACE",
label_pos = "topleft",
split_fun = split_fun,
lyt <- rtables::basic_table(main_footer = "* Patient Time is the sum of Total Duration (Days)") %>%
rtables::split_cols_by("SEX") %>% rtables::add_colcounts() %>%
summarize_patients_exposure_in_cols(var = "AVAL", col_split = TRUE,
.labels = c(n_patients = "Number of Patients", sum_exposure = paste("Sum of",
"TDURD", sprintf("(%s)", "Days"))), custom_label = "Total Number of Patients and Patient Time*") %>%
rtables::split_rows_by("RACE", label_pos = "topleft", split_fun = split_fun,
split_label = formatters::var_labels(adex["RACE"], fill = TRUE),
nested = FALSE
) %>%
summarize_patients_exposure_in_cols(var = "AVAL", col_split = FALSE)
nested = FALSE) %>% summarize_patients_exposure_in_cols(var = "AVAL",
col_split = FALSE)
),
table = quote({
result <- rtables::build_table(lyt = lyt, df = anl, alt_counts_df = adsl)
Expand Down

0 comments on commit 261f93c

Please sign in to comment.