Skip to content
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

637 remove unnecessary brackets@main #645

Merged
merged 7 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* Added a subtitle and footnotes to `tm_g_km`.
* Added Stratified Analysis CI method option panel to `tm_t_binary_outcome`.
* Added validation for covariate/visit conflicts to `tm_a_mmrm`.
* Remove unnecessary brackets from header in `tm_t_exposure`.

### Bug fixes

Expand Down
6 changes: 5 additions & 1 deletion R/tm_t_exposure.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ template_exposure <- function(parentname,
var = aval_var, col_split = TRUE,
.labels = c(
n_patients = "Number of Patients",
sum_exposure = paste("Sum of", paramcd, sprintf("(%s)", avalu_var))
sum_exposure = ifelse(
avalu_var == " ",
paste("Sum of", paramcd),
paste("Sum of", paramcd, sprintf("(%s)", avalu_var))
)
),
custom_label = "Total Number of Patients and Patient Time*"
),
Expand Down
39 changes: 27 additions & 12 deletions tests/testthat/test-tm_t_exposure.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,15 @@ testthat::test_that("template_exposure generates correct expressions with defaul
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*"
.labels = c(
n_patients = "Number of Patients",
sum_exposure = ifelse(
"Days" == " ",
paste("Sum of", "TDURD"),
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,
Expand Down Expand Up @@ -73,10 +78,15 @@ testthat::test_that("template_exposure generates correct expressions with custom
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*"
.labels = c(
n_patients = "Number of Patients",
sum_exposure = ifelse(
"Days" == " ",
paste("Sum of", "myTDURD"),
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,
Expand Down Expand Up @@ -124,10 +134,15 @@ testthat::test_that("template_exposure generates correct expressions with paramc
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*"
.labels = c(
n_patients = "Number of Patients",
sum_exposure = ifelse(
"Days" == " ",
paste("Sum of", "TDURD"),
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,
Expand Down