From 51c87f11132040e9af7a9685c6d28215187f4bdb Mon Sep 17 00:00:00 2001 From: Joe Zhu Date: Fri, 17 Jan 2025 16:36:35 +0800 Subject: [PATCH] vbump to 0.9.7, prep for release [skip vbump] (#1372) close #1281 --- DESCRIPTION | 2 +- NAMESPACE | 1 + NEWS.md | 14 +++++++------- R/package.R | 2 +- tests/testthat/test-bland-altman.R | 8 ++++---- tests/testthat/test-g_lineplot.R | 18 +++++++++--------- 6 files changed, 23 insertions(+), 22 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 633bcbd5a8..b901bfebad 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: tern Title: Create Common TLGs Used in Clinical Trials -Version: 0.9.6.9020 +Version: 0.9.7 Date: 2025-01-17 Authors@R: c( person("Joe", "Zhu", , "joe.zhu@roche.com", role = c("aut", "cre")), diff --git a/NAMESPACE b/NAMESPACE index 3ff42add0d..a2ea4dbd23 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -318,6 +318,7 @@ importFrom(grid,widthDetails) importFrom(magrittr,"%>%") importFrom(methods,new) importFrom(nestcolor,theme_nest) +importFrom(rlang,"%||%") importFrom(rlang,.data) importFrom(stats,complete.cases) importFrom(stats,pchisq) diff --git a/NEWS.md b/NEWS.md index dc0bd6a71d..4ff043990e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,19 +1,19 @@ -# tern 0.9.6.9020 +# tern 0.9.7 ### Enhancements * Added the `denom` parameter to `s_count_cumulative()`, `s_count_missed_doses()`, and `s_count_occurrences_by_grade()`. * Added `"N_row"` as an optional input to `denom` in `s_count_occurrences()`. -* Refactored `a_count_occurrences_by_grade()`, `a_count_patients_with_event()`, and `a_count_patients_with_flags()` to no longer use `make_afun()`. * Added `rel_height_plot` parameter to `g_lineplot()` to control the line plot height relative to annotation table height. -* Updated the `table_font_size` parameter of `g_lineplot()` to control the size of all text in the annotation table, including labels. * Added `as_list` parameter to `g_lineplot()` to allow users to return the line plot and annotation table elements as a list instead of stacked for more complex customization. -* Refactored `summarize_change()` and `count_values()` to work without `make_afun()`. * Added vignette "Understanding `tern` functions" for future reference. -* Refactored `analyze_vars()` and `a_summary()` to take all options from `?rtables::additional_fun_params`. * Added to `analyze_vars()` statistical names that are used by `rtables::as_result_df()`. -* Merged `compare_vars()` into `analyze_vars()` as overlap was significant. * Added the possibility to integrate custom statistical functions to default ones in `analyze_vars()`. -* Reworked `get_labels_from_stats()` to use a named list of levels for each statistic instead of row names. +* Refactored `analyze_vars()` and `a_summary()` to take all options from `?rtables::additional_fun_params`. +* Refactored `summarize_change()` and `count_values()` to work without `make_afun()`. +* Refactored `a_count_occurrences_by_grade()`, `a_count_patients_with_event()`, and `a_count_patients_with_flags()` to no longer use `make_afun()`. +* Refactored `get_labels_from_stats()` to use a named list of levels for each statistic instead of row names. +* Updated the `table_font_size` parameter of `g_lineplot()` to control the size of all text in the annotation table, including labels. +* Merged `compare_vars()` into `analyze_vars()` as overlap was significant. ### Bug Fixes * Fixed bug in `a_summary()` causing non-unique `row_name` values to occur when multiple statistics are selected for count variables. diff --git a/R/package.R b/R/package.R index 4126403ad1..7dd06b6320 100644 --- a/R/package.R +++ b/R/package.R @@ -11,7 +11,7 @@ #' @importFrom methods new #' @importFrom nestcolor theme_nest #' @importFrom Rdpack reprompt -#' @importFrom rlang .data +#' @importFrom rlang .data %||% #' @importFrom survival coxph strata Surv #' @importFrom stats pchisq setNames complete.cases qnorm qt sd NULL diff --git a/tests/testthat/test-bland-altman.R b/tests/testthat/test-bland-altman.R index 0c3287b655..bc7fdbb214 100644 --- a/tests/testthat/test-bland-altman.R +++ b/tests/testthat/test-bland-altman.R @@ -95,10 +95,10 @@ testthat::test_that("g_bland_altman works with default settings", { ) conf_level <- 0.9 - withr::with_options( + testthat::expect_silent(g_bland_altman_res <- withr::with_options( opts_partial_match_old, - g_bland_altman <- g_bland_altman(x, y, conf_level = conf_level) - ) + g_bland_altman(x, y, conf_level = conf_level) + )) - expect_snapshot_ggplot(title = "g_bland_altman", fig = g_bland_altman, width = 10, height = 8) + expect_snapshot_ggplot(title = "g_bland_altman", fig = g_bland_altman_res, width = 10, height = 8) }) diff --git a/tests/testthat/test-g_lineplot.R b/tests/testthat/test-g_lineplot.R index 6df7b2ee16..8ca60f1c81 100644 --- a/tests/testthat/test-g_lineplot.R +++ b/tests/testthat/test-g_lineplot.R @@ -67,9 +67,9 @@ testthat::test_that("g_lineplot maintains factor levels in legend", { caption = "caption" ) )) - expect_snapshot_ggplot(title = "g_lineplot_factor_levels", fig = g_lineplot_factor_levels, width = 10, height = 8) }) + testthat::test_that("g_lineplot does not produce a warning if group_var has >6 levels", { set.seed(1) adlb$FACTOR7 <- as.factor(sample(1:7, nrow(adlb), replace = TRUE)) @@ -84,7 +84,7 @@ testthat::test_that("g_lineplot does not produce a warning if group_var has >6 l }) testthat::test_that("g_lineplot works with facet_var specified", { - g_lineplot_facets <- withr::with_options( + testthat::expect_silent(g_lineplot_facets <- withr::with_options( opts_partial_match_old, g_lineplot( adlb, @@ -97,12 +97,12 @@ testthat::test_that("g_lineplot works with facet_var specified", { subtitle = "Laboratory Test:", caption = "caption" ) - ) + )) expect_snapshot_ggplot(title = "g_lineplot_facets", fig = g_lineplot_facets, width = 10, height = 8) }) testthat::test_that("g_lineplot xticks, xlim, and ylim arguments work", { - g_lineplot_xticks_by <- withr::with_options( + testthat::expect_silent(g_lineplot_xticks_by <- withr::with_options( opts_partial_match_old, g_lineplot( adlb, @@ -110,10 +110,10 @@ testthat::test_that("g_lineplot xticks, xlim, and ylim arguments work", { variables = control_lineplot_vars(x = "AVISITN"), xticks = 1 ) - ) + )) expect_snapshot_ggplot(title = "g_lineplot_xticks_by", fig = g_lineplot_xticks_by, width = 10, height = 8) - g_lineplot_xticks <- withr::with_options( + testthat::expect_silent(g_lineplot_xticks <- withr::with_options( opts_partial_match_old, g_lineplot( adlb, @@ -121,10 +121,10 @@ testthat::test_that("g_lineplot xticks, xlim, and ylim arguments work", { variables = control_lineplot_vars(x = "AVISITN"), xticks = c(0, 2.5, 5) ) - ) + )) expect_snapshot_ggplot(title = "g_lineplot_xticks", fig = g_lineplot_xticks, width = 10, height = 8) - g_lineplot_xlim_ylim <- withr::with_options( + testthat::expect_silent(g_lineplot_xlim_ylim <- withr::with_options( opts_partial_match_old, g_lineplot( adlb, @@ -134,7 +134,7 @@ testthat::test_that("g_lineplot xticks, xlim, and ylim arguments work", { ylim = c(17, 21), xticks = 1:6 ) - ) + )) expect_snapshot_ggplot(title = "g_lineplot_xlim_ylim", fig = g_lineplot_xlim_ylim, width = 10, height = 8) })