Skip to content

Commit

Permalink
prep for rspm release 0.9.6, [skip vbump] (#1311)
Browse files Browse the repository at this point in the history
close #1310

---------

Signed-off-by: Joe Zhu <joe.zhu@roche.com>
Co-authored-by: Emily de la Rua <emily.de_la_rua@contractors.roche.com>
  • Loading branch information
shajoezhu and edelarua committed Sep 24, 2024
1 parent 533ac2b commit ceb70fc
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 16 deletions.
4 changes: 2 additions & 2 deletions 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.5.9027
Version: 0.9.6
Date: 2024-09-20
Authors@R: c(
person("Joe", "Zhu", , "joe.zhu@roche.com", role = c("aut", "cre")),
Expand Down Expand Up @@ -34,7 +34,7 @@ Imports:
dplyr (>= 1.0.0),
emmeans (>= 1.10.4),
forcats (>= 1.0.0),
formatters (>= 0.5.9),
formatters (>= 0.5.8),
ggplot2 (>= 3.5.0),
grid,
gridExtra (>= 2.0.0),
Expand Down
9 changes: 5 additions & 4 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
# tern 0.9.5.9027
# tern 0.9.6

### Enhancements
* Added `errorbar_width` and `linetype` parameters to `g_lineplot`.
* Reworking of `summarize_glm_count()` documentation and all its associated functions to better describe the results and the functions' purpose.
* Added the `.formats` argument to `tabulate_rsp_subgroups` and `tabulate_survival_subgroups` to allow users to specify formats.
* Added the `riskdiff` argument to `tabulate_rsp_subgroups` and `tabulate_survival_subgroups` to allow users to add a risk difference table column, and function `control_riskdiff` to specify settings for the risk difference column.
* Added warning to `tabulate_rsp_subgroups` when `pval` statistic is selected but `df` has not been correctly generated to add p-values to the output table.
* Added `n_rate` statistic as a non-default option to `estimate_incidence_rate` which returns both number of events observed and estimated incidence rate.
* Added `n_unique` statistic as a non-default option to `estimate_incidence_rate` which returns total number of patients with at least one event observed.
* Refactored `estimate_incidence_rate` to work as both an analyze function and a summarize function, controlled by the added `summarize` parameter. When `summarize = TRUE`, labels can be fine-tuned via the new `label_fmt` argument to the same function.
* Added `fraction` statistic to the `analyze_var_count` method group.
* Improved `summarize_glm_count()` documentation and all its associated functions to better describe the results and the functions' purpose.

### Bug Fixes
* Fixed a bug in `a_surv_time` that threw an error when split only has `"is_event"`.
* Added defaults for `d_count_cumulative` parameters as described in the documentation.
* Empty levels on `g_lineplot` x-axis are not shown in either plots.
* Fixed a bug of empty levels on `g_lineplot` x-axis were not shown in either plots.
* Fixed a bug in `a_surv_time` that threw an error when split only has `"is_event"`.
* Fixed disappearing line in `g_lineplot` when using only one group or strata level.
* Fixed defaults for formats and labels in `get_formats_from_stats` and `get_labels_from_stats`.
* Fixed bug for linear scaling factor (`scale` parameter) being applied to response but not to rate in `h_glm_count` while all distributions have logarithmic link function.
Expand Down
6 changes: 4 additions & 2 deletions R/incidence_rate.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ s_incidence_rate <- function(df,
id_var = "USUBJID",
control = control_incidence_rate()) {
if (lifecycle::is_present(is_event)) {
checkmate::assert_string(is_event)
lifecycle::deprecate_warn(
"0.9.6", "s_incidence_rate(is_event)", "s_incidence_rate(n_events)"
)
n_events <- as.numeric(is_event)
n_events <- is_event
df[[n_events]] <- as.numeric(df[[is_event]])
}

assert_df_with_variables(df, list(tte = .var, n_events = n_events))
Expand All @@ -76,7 +78,7 @@ s_incidence_rate <- function(df,
checkmate::assert_numeric(df[[.var]], any.missing = FALSE)
checkmate::assert_integerish(df[[n_events]], any.missing = FALSE)

n_unique <- n_available(unique(df[[id_var]][df$n_events == 1]))
n_unique <- n_available(unique(df[[id_var]][df[[n_events]] == 1]))
input_time_unit <- control$input_time_unit
num_pt_year <- control$num_pt_year
conf_level <- control$conf_level
Expand Down
4 changes: 2 additions & 2 deletions R/riskdiff.R
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ afun_riskdiff <- function(df,
#'
#' @inheritParams add_riskdiff
#' @param format (`string` or `function`)\cr the format label (string) or formatting function to apply to the risk
#' difference statistic. See the `3d` string options in [list_valid_format_labels()] for possible format strings.
#' Defaults to `"xx.x (xx.x - xx.x)"`.
#' difference statistic. See the `3d` string options in [formatters::list_valid_format_labels()] for possible format
#' strings. Defaults to `"xx.x (xx.x - xx.x)"`.
#'
#' @return A `list` of items with names corresponding to the arguments.
#'
Expand Down
2 changes: 1 addition & 1 deletion R/summarize_colvars.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#'
#' The analyze function [summarize_colvars()] uses the statistics function [s_summary()] to analyze variables that are
#' arranged in columns. The variables to analyze should be specified in the table layout via column splits (see
#' [split_cols_by()] and [split_cols_by_multivar()]) prior to using [summarize_colvars()].
#' [rtables::split_cols_by()] and [rtables::split_cols_by_multivar()]) prior to using [summarize_colvars()].
#'
#' The function is a minimal wrapper for [rtables::analyze_colvars()], a function typically used to apply different
#' analysis methods in rows for each column variable. To use the analysis methods as column labels, please refer to
Expand Down
4 changes: 2 additions & 2 deletions man/control_riskdiff.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/summarize_colvars.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vignettes/tables.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ knitr::opts_chunk$set(

The `tern` R package provides functions to create common analyses from clinical trials in `R`.
The core functionality for tabulation is built on the more general purpose `rtables` package.
New users should first begin by reading the ["Introduction to tern"](https://insightsengineering.github.io/tern/main/articles/tern.html) and ["Introduction to `rtables`"](https://insightsengineering.github.io/rtables/latest-tag/articles/introduction.html) vignettes.
New users should first begin by reading the ["Introduction to tern"](https://insightsengineering.github.io/tern/main/articles/tern.html) and ["Introduction to `rtables`"](https://insightsengineering.github.io/rtables/latest-tag/articles/rtables.html) vignettes.

The packages used in this vignette are:

Expand Down
2 changes: 1 addition & 1 deletion vignettes/tern.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The `tern` R package contains analytical functions for creating tables and graph
The main focus is on the clinical trial reporting tables but the graphs related to the clinical trials are also valuable.
The core functionality for tabulation is built on top of the more general purpose `rtables` package.

[**It is strongly recommended that you start by reading the "Introduction to `rtables`" vignette to get familiar with the concept of `rtables`.**](https://insightsengineering.github.io/rtables/latest-tag/articles/introduction.html)
[**It is strongly recommended that you start by reading the "Introduction to `rtables`" vignette to get familiar with the concept of `rtables`.**](https://insightsengineering.github.io/rtables/latest-tag/articles/rtables.html)

---------

Expand Down

0 comments on commit ceb70fc

Please sign in to comment.