Skip to content

Commit

Permalink
vbump to 0.9.7, prep for release [skip vbump] (#1372)
Browse files Browse the repository at this point in the history
close #1281
  • Loading branch information
shajoezhu authored Jan 17, 2025
1 parent 0186b69 commit 51c87f1
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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", , "[email protected]", role = c("aut", "cre")),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 7 additions & 7 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion R/package.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-bland-altman.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
18 changes: 9 additions & 9 deletions tests/testthat/test-g_lineplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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,
Expand All @@ -97,34 +97,34 @@ 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,
adsl,
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,
adsl,
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,
Expand All @@ -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)
})

Expand Down

0 comments on commit 51c87f1

Please sign in to comment.