Skip to content

Commit

Permalink
CRAN release: update description and news version to 0.8.3, [skip vbu…
Browse files Browse the repository at this point in the history
…mp] (#970)

This PR tracks CRAN submission and release

---------

Signed-off-by: Joe Zhu <[email protected]>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jun 20, 2023
1 parent 395503f commit c69a6f7
Show file tree
Hide file tree
Showing 103 changed files with 139 additions and 1,533 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# doc
^CODE_OF_CONDUCT\.md$
^docs$
LICENSE
^LICENSE\.md$
^SECURITY\.md$

Expand Down
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.8.2.9014
Version: 0.8.3
Date: 2023-06-15
Authors@R: c(
person("Joe", "Zhu", , "[email protected]", role = c("aut", "cre")),
Expand All @@ -16,7 +16,7 @@ Authors@R: c(
)
Description: Table, Listings, and Graphs (TLG) library for common outputs
used in clinical trials.
License: Apache License 2.0 | file LICENSE
License: Apache License 2.0
URL: https://github.com/insightsengineering/tern
BugReports: https://github.com/insightsengineering/tern/issues
Depends:
Expand Down
8 changes: 8 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ export(CombinationFunction)
export(a_compare)
export(a_count_occurrences)
export(a_count_occurrences_by_grade)
export(a_count_patients_sum_exposure)
export(a_count_patients_with_event)
export(a_count_patients_with_flags)
export(a_count_values)
export(a_coxreg)
export(a_length_proportion)
export(a_odds_ratio)
export(a_proportion)
Expand All @@ -45,7 +47,9 @@ export(analyze_num_patients)
export(analyze_patients_exposure_in_cols)
export(analyze_vars_in_cols)
export(append_varlabels)
export(arrange_grobs)
export(as.rtable)
export(combine_counts)
export(combine_groups)
export(combine_levels)
export(combine_vectors)
Expand Down Expand Up @@ -110,6 +114,7 @@ export(fit_coxreg_univar)
export(fit_logistic)
export(fit_rsp_step)
export(fit_survival_step)
export(forest_viewport)
export(format_count_fraction)
export(format_count_fraction_fixed_dp)
export(format_extreme_values)
Expand All @@ -125,6 +130,7 @@ export(g_lineplot)
export(g_step)
export(g_waterfall)
export(get_smooths)
export(groups_list_to_df)
export(h_adlb_worsen)
export(h_adsl_adlb_merge_using_worst_flag)
export(h_ancova)
Expand Down Expand Up @@ -202,6 +208,8 @@ export(h_tbl_median_surv)
export(h_worsen_counter)
export(h_xticks)
export(has_count_in_any_col)
export(has_count_in_cols)
export(has_counts_difference)
export(has_fraction_in_any_col)
export(has_fraction_in_cols)
export(has_fractions_difference)
Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# tern 0.8.2.9014
# tern 0.8.3

### Enhancements
* Added explicit zero counts to `g_km` plot "at risk" annotation tables.
Expand All @@ -14,6 +14,8 @@
* Fixed `tern:::tidy.glm` formals to respect `broom:::tidy.default` formals.

### Miscellaneous
* Remove examples for unexported functions.
* Export functions `has_count_in_cols`, `has_counts_difference`, `combine_counts`, `h_tab_rsp_one_biomarker`, `arrange_grobs`, `a_count_patients_sum_exposure`, `a_coxreg`, `groups_list_to_df`, `forest_viewport`.
* Updated README to include installation instructions for CRAN.
* Began deprecation of `indent_mod` argument and replace it with the `.indent_mods` argument in `summarize_num_patients` and `analyze_num_patients`.

Expand Down
24 changes: 0 additions & 24 deletions R/abnormal.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ NULL
#'
#' @return
#' * `s_count_abnormal()` returns the statistic `fraction` which is a vector with `num` and `denom` counts of patients.
#'
#' @examples
#' library(dplyr)
#'
Expand All @@ -48,21 +47,6 @@ NULL
#' # Select only post-baseline records.
#' df <- df %>%
#' filter(ONTRTFL == "Y")
#'
#' # Internal function - s_count_abnormal
#' \dontrun{
#' # For abnormal level "HIGH" we get the following counts.
#' s_count_abnormal(df, .var = "ANRIND", abnormal = list(high = "HIGH", low = "LOW"))
#'
#' # Optionally exclude patients with abnormality at baseline.
#' s_count_abnormal(
#' df,
#' .var = "ANRIND",
#' abnormal = list(high = "HIGH", low = "LOW"),
#' exclude_base_abn = TRUE
#' )
#' }
#'
#' @keywords internal
s_count_abnormal <- function(df,
.var,
Expand Down Expand Up @@ -112,14 +96,6 @@ s_count_abnormal <- function(df,
#' @return
#' * `a_count_abnormal()` returns the corresponding list with formatted [rtables::CellValue()].
#'
#' @examples
#' # Internal function - a_count_abnormal
#' \dontrun{
#' # Use the Formatted Analysis function for `analyze()`.
#' a_fun <- make_afun(a_count_abnormal, .ungroup_stats = "fraction")
#' a_fun(df, .var = "ANRIND", abnormal = list(low = "LOW", high = "HIGH"))
#' }
#'
#' @keywords internal
a_count_abnormal <- make_afun(
s_count_abnormal,
Expand Down
28 changes: 7 additions & 21 deletions R/abnormal_by_baseline.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,6 @@ d_count_abnormal_by_baseline <- function(abnormal) {
#' * `s_count_abnormal_by_baseline()` returns statistic `fraction` which is a named list with 3 labeled elements:
#' `not_abnormal`, `abnormal`, and `total`. Each element contains a vector with `num` and `denom` patient counts.
#'
#' @examples
#' df <- data.frame(
#' USUBJID = as.character(c(1:6)),
#' ANRIND = factor(c(rep("LOW", 4), "NORMAL", "HIGH")),
#' BNRIND = factor(c("LOW", "NORMAL", "HIGH", NA, "LOW", "NORMAL"))
#' )
#' df <- df_explicit_na(df)
#'
#' # Internal function - s_count_abnormal_by_baseline
#' \dontrun{
#' # Just for one abnormal level.
#' s_count_abnormal_by_baseline(df, .var = "ANRIND", abnormal = "HIGH")
#' }
#'
#' @keywords internal
s_count_abnormal_by_baseline <- function(df,
Expand Down Expand Up @@ -147,14 +134,6 @@ s_count_abnormal_by_baseline <- function(df,
#' @return
#' * `a_count_abnormal_by_baseline()` returns the corresponding list with formatted [rtables::CellValue()].
#'
#' @examples
#' # Internal function - a_count_abnormal_by_baseline
#' \dontrun{
#' # Use the Formatted Analysis function for `analyze()`. We need to ungroup `fraction` first
#' # so that the `rtables` formatting function `format_fraction()` can be applied correctly.
#' afun <- make_afun(a_count_abnormal_by_baseline, .ungroup_stats = "fraction")
#' afun(df, .var = "ANRIND", abnormal = "LOW")
#' }
#'
#' @keywords internal
a_count_abnormal_by_baseline <- make_afun(
Expand All @@ -171,6 +150,13 @@ a_count_abnormal_by_baseline <- make_afun(
#' the statistics from `s_count_abnormal_by_baseline()` to the table layout.
#'
#' @examples
#' df <- data.frame(
#' USUBJID = as.character(c(1:6)),
#' ANRIND = factor(c(rep("LOW", 4), "NORMAL", "HIGH")),
#' BNRIND = factor(c("LOW", "NORMAL", "HIGH", NA, "LOW", "NORMAL"))
#' )
#' df <- df_explicit_na(df)
#'
#' # Layout creating function.
#' basic_table() %>%
#' count_abnormal_by_baseline(var = "ANRIND", abnormal = c(High = "HIGH")) %>%
Expand Down
21 changes: 0 additions & 21 deletions R/abnormal_by_marked.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,6 @@ NULL
#' full_parent_df = I(full_parent_df),
#' cur_col_subset = I(cur_col_subset)
#' )
#' # Internal function - s_count_abnormal_by_marked
#' \dontrun{
#' s_count_abnormal_by_marked(
#' df = df_crp %>% filter(abn_dir == "High"),
#' .spl_context = spl_context,
#' .var = "AVALCAT1",
#' variables = list(id = "USUBJID", param = "PARAMCD", direction = "abn_dir")
#' )
#' }
#'
#' @keywords internal
s_count_abnormal_by_marked <- function(df,
Expand Down Expand Up @@ -137,18 +128,6 @@ s_count_abnormal_by_marked <- function(df,
#' @return
#' * `a_count_abnormal_by_marked()` returns the corresponding list with formatted [rtables::CellValue()].
#'
#' @examples
#' # Internal function - a_count_abnormal_by_marked
#' \dontrun{
#' # Use the Formatted Analysis function for `analyze()`. We need to ungroup `count_fraction` first
#' # so that the `rtables` formatting function `format_count_fraction()` can be applied correctly.
#' afun <- make_afun(a_count_abnormal_by_marked, .ungroup_stats = "count_fraction")
#' afun(
#' df = df_crp %>% filter(abn_dir == "High"),
#' .spl_context = spl_context,
#' variables = list(id = "USUBJID", param = "PARAMCD", direction = "abn_dir")
#' )
#' }
#'
#' @keywords internal
a_count_abnormal_by_marked <- make_afun(
Expand Down
17 changes: 0 additions & 17 deletions R/abnormal_by_worst_grade.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,6 @@ NULL
#' cur_col_subset = I(cur_col_subset)
#' )
#'
#' # Internal function - s_count_abnormal_by_worst_grade
#' \dontrun{
#' s_count_abnormal_by_worst_grade(
#' df = adlb_f_alt,
#' .spl_context = spl_context,
#' .var = "GRADE_ANL"
#' )
#' }
#'
#' @keywords internal
s_count_abnormal_by_worst_grade <- function(df, # nolint
.var = "GRADE_ANL",
Expand Down Expand Up @@ -137,14 +128,6 @@ s_count_abnormal_by_worst_grade <- function(df, # nolint
#' @return
#' * `a_count_abnormal_by_worst_grade()` returns the corresponding list with formatted [rtables::CellValue()].
#'
#' @examples
#' # Internal function - a_count_abnormal_by_worst_grade
#' \dontrun{
#' # Use the Formatted Analysis function for `analyze()`. We need to ungroup `count_fraction` first
#' # so that the `rtables` formatting function `format_count_fraction()` can be applied correctly.
#' afun <- make_afun(a_count_abnormal_by_worst_grade, .ungroup_stats = "count_fraction")
#' afun(df = adlb_f_alt, .spl_context = spl_context)
#' }
#'
#' @keywords internal
a_count_abnormal_by_worst_grade <- make_afun( # nolint
Expand Down
23 changes: 0 additions & 23 deletions R/abnormal_by_worst_grade_worsen.R
Original file line number Diff line number Diff line change
Expand Up @@ -293,19 +293,6 @@ h_worsen_counter <- function(df, id, .var, baseline_var, direction_var) {
#' worst_flag_high = c("WGRHIFL" = "Y"),
#' direction_var = "GRADDR"
#' )
#' # Internal function - s_count_abnormal_lab_worsen_by_baseline
#' \dontrun{
#' # Patients with worsening lab grade for CRP in the direction of low
#' s_count_abnormal_lab_worsen_by_baseline(
#' df = df %>% filter(ARMCD == "ARM A" & PARAMCD == "CRP"),
#' .var = "ATOXGR",
#' variables = list(
#' id = "USUBJID",
#' baseline_var = "BTOXGR",
#' direction_var = "GRADDR"
#' )
#' )
#' }
#'
#' @keywords internal
s_count_abnormal_lab_worsen_by_baseline <- function(df, # nolint
Expand Down Expand Up @@ -334,16 +321,6 @@ s_count_abnormal_lab_worsen_by_baseline <- function(df, # nolint
#' * `a_count_abnormal_lab_worsen_by_baseline()` returns the corresponding list with
#' formatted [rtables::CellValue()].
#'
#' @examples
#' # Internal function - a_count_abnormal_lab_worsen_by_baseline
#' \dontrun{
#' a_count_abnormal_lab_worsen_by_baseline(
#' df = df %>% filter(ARMCD == "ARM A" & PARAMCD == "CRP"),
#' .var = "ATOXGR",
#' variables = list(id = "USUBJID", baseline_var = "BTOXGR", direction_var = "GRADDR")
#' )
#' }
#'
#' @keywords internal
a_count_abnormal_lab_worsen_by_baseline <- make_afun( # nolint
s_count_abnormal_lab_worsen_by_baseline,
Expand Down
19 changes: 0 additions & 19 deletions R/count_cumulative.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,6 @@ d_count_cumulative <- function(threshold, lower_tail, include_eq) {
#' * `s_count_cumulative()` returns a named list of `count_fraction`s: a list with each `thresholds` value as a
#' component, each component containing a vector for the count and fraction.
#'
#' @examples
#' # Internal function - s_count_cumulative
#' \dontrun{
#' set.seed(1, kind = "Mersenne-Twister")
#' x <- c(sample(1:10, 10), NA)
#' .N_col <- length(x)
#' s_count_cumulative(x, thresholds = c(0, 5, 11), .N_col = .N_col)
#' s_count_cumulative(x, thresholds = c(0, 5, 11), include_eq = FALSE, na.rm = FALSE, .N_col = .N_col)
#' }
#'
#' @keywords internal
s_count_cumulative <- function(x,
thresholds,
Expand All @@ -132,15 +122,6 @@ s_count_cumulative <- function(x,
#' @return
#' * `a_count_cumulative()` returns the corresponding list with formatted [rtables::CellValue()].
#'
#' @examples
#' # Internal function - a_count_cumulative
#' \dontrun{
#' # Use the Formatted Analysis function for `analyze()`. We need to ungroup `count_fraction` first
#' # so that the `rtables` formatting function `format_count_fraction()` can be applied correctly.
#' afun <- make_afun(a_count_cumulative, .ungroup_stats = "count_fraction")
#' afun(x, thresholds = c(0, 5, 11), .N_col = .N_col)
#' }
#'
#' @keywords internal
a_count_cumulative <- make_afun(
s_count_cumulative,
Expand Down
20 changes: 0 additions & 20 deletions R/count_missed_doses.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ NULL
#' set.seed(1)
#' x <- c(sample(1:10, 10), NA)
#'
#' # Internal function - s_count_nonmissing
#' \dontrun{
#' s_count_nonmissing(x)
#' }
#'
#' @keywords internal
s_count_nonmissing <- function(x) {
list(n = n_available(x))
Expand Down Expand Up @@ -53,12 +48,6 @@ d_count_missed_doses <- function(thresholds) {
#' @return
#' * `s_count_missed_doses()` returns the statistics `n` and `count_fraction` with one element for each threshold.
#'
#' @examples
#' # Internal function - s_count_missed_doses
#' \dontrun{
#' s_count_missed_doses(x = c(0, 1, 0, 2, 3, 4, 0, 2), thresholds = c(2, 5), .N_col = 10)
#' }
#'
#' @keywords internal
s_count_missed_doses <- function(x,
thresholds,
Expand All @@ -84,15 +73,6 @@ s_count_missed_doses <- function(x,
#' @return
#' * `a_count_missed_doses()` returns the corresponding list with formatted [rtables::CellValue()].
#'
#' @examples
#' # Internal function - a_count_missed_doses
#' \dontrun{
#' # We need to ungroup `count_fraction` first so that the `rtables` formatting
#' # function `format_count_fraction()` can be applied correctly.
#' afun <- make_afun(a_count_missed_doses, .ungroup_stats = "count_fraction")
#' afun(x = c(0, 1, 0, 2, 3, 4, 0, 2), thresholds = c(2, 5), .N_col = 10)
#' }
#'
#' @keywords internal
a_count_missed_doses <- make_afun(
s_count_missed_doses,
Expand Down
12 changes: 0 additions & 12 deletions R/count_patients_events_in_cols.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,6 @@ NULL
#' AEBODSYS = rep(c("SOC1", "SOC2", "SOC3"), c(3, 3, 1))
#' )
#'
#' # Internal function - s_count_patients_and_multiple_events
#' \dontrun{
#' s_count_patients_and_multiple_events(
#' df = df,
#' id = "USUBJID",
#' filters_list = list(
#' serious = c(AESER = "Y"),
#' fatal = c(AESDTH = "Y")
#' )
#' )
#' }
#'
#' @keywords internal
s_count_patients_and_multiple_events <- function(df, # nolint
id,
Expand Down
Loading

0 comments on commit c69a6f7

Please sign in to comment.