diff --git a/NEWS.md b/NEWS.md index c8c2415d3a..0db9b5f8f3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,13 @@ * Added `ref_group_position` function to place the reference group facet last, first or at a certain position. * Added `keep_level_order` split function to retain original order of levels in a split. * Added `level_order` split function to reorder manually the levels. +* Added function `get_indents_from_stats` to format and return indent modifiers for a given set of statistics. +* Added summarize function version of `count_occurrences` analyze function, `summarize_occurrences`. +* Added referential footnotes to `surv_time` for censored range observations. + +### Enhancements +* Updated `get_formats_from_stats` and `get_labels_from_stats` with added `method` parameter to retrieve method-specific defaults. +* Updated `get_labels_from_stats` with added `control` parameter to auto-adjust default labels based on statistic control parameters. ### Miscellaneous * Specified minimal version of package dependencies. @@ -12,8 +19,6 @@ ### New Features * Added the `na_str` argument to `analyze` & `summarize_row_groups` wrapper functions `count_abnormal`, `count_abnormal_by_baseline`, `count_abnormal_by_marked`, `count_abnormal_by_worst_grade`, `count_abnormal_lab_worsen_by_baseline`, `count_cumulative`, `count_missed_doses`, `count_occurrences`, `count_occurrences_by_grade`, `summarize_occurrences_by_grade`, `summarize_patients_events_in_cols`, `count_patients_with_event`, `count_patients_with_flags`, `count_values`, `estimate_multinomial_response`, `estimate_proportion`, `h_tab_one_biomarker`, `estimate_incidence_rate`, `logistic_summary_by_flag`, `estimate_odds_ratio`, `estimate_proportion_diff`, `test_proportion_diff`, `summarize_ancova`, `summarize_change`, `summarize_glm_count`, `summarize_num_patients`, `analyze_num_patients`, `summarize_patients_exposure_in_cols`, `coxph_pairwise`, `tabulate_survival_subgroups`, `surv_time`, and `surv_timepoint`. -* Added function `get_indents_from_stats` to format and return indent modifiers for a given set of statistics. -* Added summarize function version of `count_occurrences` analyze function, `summarize_occurrences`. ### Enhancements * Added formatting function `format_count_fraction_lt10` for formatting `count_fraction` with special consideration when count is less than 10. diff --git a/R/utils_default_stats_formats_labels.R b/R/utils_default_stats_formats_labels.R index adcd1add06..424168df7b 100644 --- a/R/utils_default_stats_formats_labels.R +++ b/R/utils_default_stats_formats_labels.R @@ -137,6 +137,9 @@ get_stats <- function(method_groups = "analyze_vars_numeric", stats_in = NULL, a #' #' @param formats_in (named `vector`) \cr inserted formats to replace defaults. It can be a #' character vector from [formatters::list_valid_format_labels()] or a custom format function. +#' @param method (`character`) name of statistical method group from which to draw alternative +#' default formats from. E.g. For `method = "surv_time"`, the default format for `range` is +#' `"xx.x to xx.x"` instead of the tern default, `"xx.x - xx.x"`. #' #' @return #' * `get_formats_from_stats()` returns a named list of formats, they being a value from @@ -202,6 +205,12 @@ get_formats_from_stats <- function(stats, formats_in = NULL, method = NULL) { #' variable levels will be used as the defaults, and the names of the given custom values should #' correspond to levels (or have format `statistic.level`) instead of statistics. Can also be #' variable names if rows correspond to different variables instead of levels. Defaults to `NULL`. +#' @param method (`character`) name of statistical method group from which to draw alternative +#' default formats from. E.g. For `method = "surv_time"`, the default label for `range` is +#' `"Range"` instead of the tern default, `"Min - Max"`. +#' @param control (named `list`) list of control parameters to apply to automatically adjust +#' default labels. E.g. If control has element `conf_level` set to `0.9`, the default label for +#' statistic `mean_ci` will become `"Mean 90% CI"`. #' #' @return #' * `get_labels_from_stats()` returns a named character vector of default labels (if present diff --git a/man/default_stats_formats_labels.Rd b/man/default_stats_formats_labels.Rd index 12a6cff1f3..52c4e26207 100644 --- a/man/default_stats_formats_labels.Rd +++ b/man/default_stats_formats_labels.Rd @@ -75,6 +75,10 @@ methods.} \item{formats_in}{(named \code{vector}) \cr inserted formats to replace defaults. It can be a character vector from \code{\link[formatters:list_formats]{formatters::list_valid_format_labels()}} or a custom format function.} +\item{method}{(\code{character}) name of statistical method group from which to draw alternative +default formats from. E.g. For \code{method = "surv_time"}, the default label for \code{range} is +\code{"Range"} instead of the tern default, \code{"Min - Max"}.} + \item{labels_in}{(named \code{vector})\cr inserted labels to replace defaults.} \item{row_nms}{(\code{character})\cr row names. Levels of a \code{factor} or \code{character} variable, each @@ -83,6 +87,10 @@ variable levels will be used as the defaults, and the names of the given custom correspond to levels (or have format \code{statistic.level}) instead of statistics. Can also be variable names if rows correspond to different variables instead of levels. Defaults to \code{NULL}.} +\item{control}{(named \code{list}) list of control parameters to apply to automatically adjust +default labels. E.g. If control has element \code{conf_level} set to \code{0.9}, the default label for +statistic \code{mean_ci} will become \code{"Mean 90\% CI"}.} + \item{indents_in}{(named \code{vector})\cr inserted indent modifiers to replace defaults (default is \code{0L}).} \item{type}{(\code{flag})\cr is it going to be \code{"numeric"} or \code{"counts"}?}