Skip to content

Commit

Permalink
578 Fix broken example for tm_t_abnormality_by_worst_grade (#579)
Browse files Browse the repository at this point in the history
* Fix broken example for tm_t_abnormality_by_worst_grade

* Update NEWS
  • Loading branch information
edelarua authored Aug 29, 2022
1 parent 0fb49d5 commit b015d94
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

### Bug fixes
* Fixed bug in `tm_g_barchart_simple` which prevented graph from being shown.
* Fixed broken example for `tm_t_abnormality_by_worst_grade`.

### Miscellaneous
* Added `nestcolor` dependency and replaced deprecated function `tern::color_palette` with `nestcolor::color_palette`
Expand Down
6 changes: 5 additions & 1 deletion R/tm_t_abnormality_by_worst_grade.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ template_abnormality_by_worst_grade <- function(parentname, # nolint
data_list <- add_expr(
data_list,
quote(
expr = formatters::var_labels(anl) <- c(anl_labels, "Direction of Abnormality", "Highest Grade")
expr = formatters::var_labels(anl) <- c(
anl_labels,
GRADE_DIR = "Direction of Abnormality",
GRADE_ANL = "Highest Grade"
)
)
)

Expand Down
12 changes: 10 additions & 2 deletions tests/testthat/test-tm_t_abnormality_by_worst_grade.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ testthat::test_that("template_abnormality_by_worst_grade generates correct expre
) %>%
dplyr::filter(WGRLOFL == "Y" | WGRHIFL == "Y") %>%
droplevels()
formatters::var_labels(anl) <- c(anl_labels, "Direction of Abnormality", "Highest Grade")
formatters::var_labels(anl) <- c(
anl_labels,
GRADE_DIR = "Direction of Abnormality",
GRADE_ANL = "Highest Grade"
)
anl <- anl %>% dplyr::mutate(ARMCD = droplevels(ARMCD))
arm_levels <- levels(anl[["ARMCD"]])
adsl <- adsl %>% dplyr::filter(ARMCD %in% arm_levels)
Expand Down Expand Up @@ -116,7 +120,11 @@ testthat::test_that("template_abnormality_by_worst_grade generates correct expre
) %>%
dplyr::filter(WGRLOFL == "Y" | WGRHIFL == "Y") %>%
droplevels()
formatters::var_labels(anl) <- c(anl_labels, "Direction of Abnormality", "Highest Grade")
formatters::var_labels(anl) <- c(
anl_labels,
GRADE_DIR = "Direction of Abnormality",
GRADE_ANL = "Highest Grade"
)
anl <- anl %>% dplyr::mutate(ARMCD = droplevels(ARMCD))
arm_levels <- levels(anl[["ARMCD"]])
myadsl <- myadsl %>% dplyr::filter(ARMCD %in% arm_levels)
Expand Down

0 comments on commit b015d94

Please sign in to comment.