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

update rmpt01_test #46

Merged
merged 5 commits into from
May 17, 2023
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
8 changes: 4 additions & 4 deletions tests/testthat/test-table_rmpt01.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ testthat::test_that("RMPT01 is produced correctly", {
.labels = c(n_patients = "Number of Patients", sum_exposure = "Patient Time*"),
custom_label = "Total Number of Patients and Patient Time"
) %>%
split_rows_by("aval_months_cat", label_pos = "topleft", split_label = "Duration of exposure") %>%
summarize_patients_exposure_in_cols(
var = "AVAL",
analyze_patients_exposure_in_cols(
var = "aval_months_cat",
col_split = FALSE
)
) %>%
append_topleft(c("", "Duration of exposure"))

result <- build_table(lyt, df = anl, alt_counts_df = adsl_f)

Expand Down
22 changes: 10 additions & 12 deletions tests/testthat/test-table_rmpt03.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ testthat::test_that("RMPT03 variant 1 is produced correctly", {
.labels = c(n_patients = "Number of Patients", sum_exposure = "Patient Time*"),
custom_label = "Total Number of Patients and Patient Time"
) %>%
split_rows_by("AGEGR1", label_pos = "topleft", split_label = "Age group (years)") %>%
summarize_patients_exposure_in_cols(
var = "AVAL",
analyze_patients_exposure_in_cols(
var = "AGEGR1",
col_split = FALSE
)
) %>%
append_topleft(c("", "Age group (years)"))

result <- build_table(lyt, df = anl, alt_counts_df = adsl_f)

Expand All @@ -78,16 +78,14 @@ testthat::test_that("RMPT03 variant 2 is produced correctly", {
.labels = c(n_patients = "Number of Patients", sum_exposure = "Patient Time*"),
custom_label = "Total Number of Patients and Patient Time"
) %>%
split_rows_by("AGEGR2",
split_fun = drop_split_levels, # "< 18" dropped
label_pos = "topleft", split_label = "Age group (years)"
) %>%
summarize_patients_exposure_in_cols(
var = "AVAL",
analyze_patients_exposure_in_cols(
var = "AGEGR2",
col_split = FALSE
)
) %>%
append_topleft(c("", "Age group (years)"))

result <- build_table(lyt, df = anl, alt_counts_df = adsl_f)
result <- build_table(lyt, df = anl, alt_counts_df = adsl_f) %>%
prune_table()

res <- testthat::expect_silent(result)
testthat::expect_snapshot(res)
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-table_rmpt04.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ testthat::test_that("RMPT04 variant 1 is produced correctly", {
.labels = c(n_patients = "Number of Patients", sum_exposure = "Patient Time*"),
custom_label = "Total Number of Patients and Patient Time"
) %>%
split_rows_by("ETHNIC", label_pos = "topleft", split_label = "Ethnicity") %>%
summarize_patients_exposure_in_cols(
var = "AVAL",
analyze_patients_exposure_in_cols(
var = "ETHNIC",
col_split = FALSE
)
) %>%
append_topleft(c("", "Ethnicity"))

result <- build_table(lyt, df = anl, alt_counts_df = adsl_f)

Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-table_rmpt05.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ testthat::test_that("RMPT05 is produced correctly", {
var = "AVAL", col_split = TRUE,
.labels = c(n_patients = "Patients", sum_exposure = "Person time*")
) %>%
split_rows_by("RACE", label_pos = "topleft", split_label = obj_label(adex$RACE)) %>%
summarize_patients_exposure_in_cols(
var = "AVAL",
analyze_patients_exposure_in_cols(
var = "RACE",
col_split = FALSE
)
) %>%
append_topleft(c("", obj_label(adex$RACE)))

result <- build_table(lyt, df = anl, alt_counts_df = adsl_f)

Expand Down