Skip to content

Commit

Permalink
Finalize deprecation of <0.9.4 arguments (#1304)
Browse files Browse the repository at this point in the history
Fixes #1303
  • Loading branch information
edelarua authored Sep 6, 2024
1 parent 9ce659d commit dfaa310
Show file tree
Hide file tree
Showing 18 changed files with 21 additions and 52 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
### Miscellaneous
* Began deprecation of the confusing functions `summary_formats` and `summary_labels`.
* Enhanced general descriptions of analyze and summarize functions throughout package documentation.
* Finalized deprecation of the `strata` and `cohort_id` arguments to `g_lineplot`.

# tern 0.9.5

Expand Down
4 changes: 0 additions & 4 deletions R/argument_convention.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#' @param conf_level (`proportion`)\cr confidence level of the interval.
#' @param data (`data.frame`)\cr the dataset containing the variables to summarize.
#' @param df (`data.frame`)\cr data set containing all analysis variables.
#' @param draw (`flag`)\cr whether the plot should be drawn.
#' @param groups_lists (named `list` of `list`)\cr optionally contains for each `subgroups` variable a
#' list, which specifies the new group levels via the names and the
#' levels that belong to it in the character vectors that are elements of the list.
Expand All @@ -49,8 +48,6 @@
#' @param nested (`flag`)\cr whether this layout instruction should be applied within the existing layout structure _if
#' possible (`TRUE`, the default) or as a new top-level element (`FALSE`). Ignored if it would nest a split.
#' underneath analyses, which is not allowed.
#' @param newpage (`flag`)\cr whether the plot should be drawn on a new page.
#' Only considered if `draw = TRUE` is used.
#' @param prune_zero_rows (`flag`)\cr whether to prune all zero rows.
#' @param riskdiff (`flag`)\cr whether a risk difference column is present. When set to `TRUE`, [add_riskdiff()] must be
#' used as `split_fun` in the prior column split of the table layout, specifying which columns should be compared.
Expand All @@ -72,7 +69,6 @@
#' @param ylim (`numeric(2)`)\cr vector containing lower and upper limits for the y-axis, respectively.
#' If `NULL` (default), the default scale range is used.
#'
#'
#' @details Although this function just returns `NULL` it has two uses, for
#' the `tern` users it provides a documentation of arguments that are
#' commonly and consistently used in the framework. For the developer it adds a
Expand Down
10 changes: 5 additions & 5 deletions R/g_forest.R
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,19 @@ g_forest <- function(tbl,
# Deprecated argument warnings
if (lifecycle::is_present(width_row_names)) {
lifecycle::deprecate_warn(
"0.9.3", "g_forest(width_row_names)", "g_forest(lbl_col_padding)",
"0.9.4", "g_forest(width_row_names)", "g_forest(lbl_col_padding)",
details = "The width of the row label column can be adjusted via the `lbl_col_padding` parameter."
)
}
if (lifecycle::is_present(width_forest)) {
lifecycle::deprecate_warn(
"0.9.3", "g_forest(width_forest)", "g_forest(rel_width_forest)",
"0.9.4", "g_forest(width_forest)", "g_forest(rel_width_forest)",
details = "Relative width of the forest plot (as a proportion) can be set via the `rel_width_forest` parameter."
)
}
if (lifecycle::is_present(gp)) {
lifecycle::deprecate_warn(
"0.9.3", "g_forest(gp)", "g_forest(ggtheme)",
"0.9.4", "g_forest(gp)", "g_forest(ggtheme)",
details = paste(
"`g_forest` is now generated as a `ggplot` object.",
"Additional display settings should be supplied via the `ggtheme` parameter."
Expand All @@ -203,13 +203,13 @@ g_forest <- function(tbl,
}
if (lifecycle::is_present(draw)) {
lifecycle::deprecate_warn(
"0.9.3", "g_forest(draw)",
"0.9.4", "g_forest(draw)",
details = "`g_forest` now generates `ggplot` objects. This parameter has no effect."
)
}
if (lifecycle::is_present(newpage)) {
lifecycle::deprecate_warn(
"0.9.3", "g_forest(newpage)",
"0.9.4", "g_forest(newpage)",
details = "`g_forest` now generates `ggplot` objects. This parameter has no effect."
)
}
Expand Down
16 changes: 1 addition & 15 deletions R/g_lineplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -548,9 +548,7 @@ h_format_row <- function(x, format, labels = NULL) {
#' @param x (`string`)\cr x-variable name.
#' @param y (`string`)\cr y-variable name.
#' @param group_var (`string` or `NA`)\cr group variable name.
#' @param strata `r lifecycle::badge("deprecated")` use the `group_var` parameter instead.
#' @param subject_var (`string` or `NA`)\cr subject variable name.
#' @param cohort_id `r lifecycle::badge("deprecated")` use the `subject_var` parameter instead.
#' @param facet_var (`string` or `NA`)\cr faceting variable name.
#' @param paramcd (`string` or `NA`)\cr parameter code variable name.
#' @param y_unit (`string` or `NA`)\cr y-axis unit variable name.
Expand All @@ -568,19 +566,7 @@ control_lineplot_vars <- function(x = "AVISIT",
facet_var = NA,
paramcd = "PARAMCD",
y_unit = "AVALU",
subject_var = "USUBJID",
strata = lifecycle::deprecated(),
cohort_id = lifecycle::deprecated()) {
if (lifecycle::is_present(strata)) {
lifecycle::deprecate_warn("0.9.2", "control_lineplot_vars(strata)", "control_lineplot_vars(group_var)")
group_var <- strata
}

if (lifecycle::is_present(cohort_id)) {
lifecycle::deprecate_warn("0.9.2", "control_lineplot_vars(cohort_id)", "control_lineplot_vars(subject_id)")
subject_id <- cohort_id
}

subject_var = "USUBJID") {
checkmate::assert_string(x)
checkmate::assert_string(y)
checkmate::assert_string(group_var, na.ok = TRUE, null.ok = TRUE)
Expand Down
2 changes: 1 addition & 1 deletion R/h_km.R
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ h_tbl_coxph_pairwise <- function(df,
if ("strat" %in% names(variables)) {
warning(
"Warning: the `strat` element name of the `variables` list argument to `h_tbl_coxph_pairwise() ",
"was deprecated in tern 0.9.3.\n ",
"was deprecated in tern 0.9.4.\n ",
"Please use the name `strata` instead of `strat` in the `variables` argument."
)
variables[["strata"]] <- variables[["strat"]]
Expand Down
4 changes: 2 additions & 2 deletions R/h_response_biomarkers_subgroups.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ h_rsp_to_logistic_variables <- function(variables, biomarker) {
if ("strat" %in% names(variables)) {
warning(
"Warning: the `strat` element name of the `variables` list argument to `h_rsp_to_logistic_variables() ",
"was deprecated in tern 0.9.3.\n ",
"was deprecated in tern 0.9.4.\n ",
"Please use the name `strata` instead of `strat` in the `variables` argument."
)
variables[["strata"]] <- variables[["strat"]]
Expand Down Expand Up @@ -106,7 +106,7 @@ h_logistic_mult_cont_df <- function(variables,
if ("strat" %in% names(variables)) {
warning(
"Warning: the `strat` element name of the `variables` list argument to `h_logistic_mult_cont_df() ",
"was deprecated in tern 0.9.3.\n ",
"was deprecated in tern 0.9.4.\n ",
"Please use the name `strata` instead of `strat` in the `variables` argument."
)
variables[["strata"]] <- variables[["strat"]]
Expand Down
2 changes: 1 addition & 1 deletion R/h_response_subgroups.R
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ h_odds_ratio_subgroups_df <- function(variables,
if ("strat" %in% names(variables)) {
warning(
"Warning: the `strat` element name of the `variables` list argument to `h_odds_ratio_subgroups_df() ",
"was deprecated in tern 0.9.3.\n ",
"was deprecated in tern 0.9.4.\n ",
"Please use the name `strata` instead of `strat` in the `variables` argument."
)
variables[["strata"]] <- variables[["strat"]]
Expand Down
2 changes: 1 addition & 1 deletion R/h_survival_biomarkers_subgroups.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ h_coxreg_mult_cont_df <- function(variables,
if ("strat" %in% names(variables)) {
warning(
"Warning: the `strat` element name of the `variables` list argument to `h_coxreg_mult_cont_df() ",
"was deprecated in tern 0.9.3.\n ",
"was deprecated in tern 0.9.4.\n ",
"Please use the name `strata` instead of `strat` in the `variables` argument."
)
variables[["strata"]] <- variables[["strat"]]
Expand Down
2 changes: 1 addition & 1 deletion R/h_survival_duration_subgroups.R
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ h_coxph_subgroups_df <- function(variables,
if ("strat" %in% names(variables)) {
warning(
"Warning: the `strat` element name of the `variables` list argument to `h_coxph_subgroups_df() ",
"was deprecated in tern 0.9.3.\n ",
"was deprecated in tern 0.9.4.\n ",
"Please use the name `strata` instead of `strat` in the `variables` argument."
)
variables[["strata"]] <- variables[["strat"]]
Expand Down
2 changes: 1 addition & 1 deletion R/response_biomarkers_subgroups.R
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ extract_rsp_biomarkers <- function(variables,
if ("strat" %in% names(variables)) {
warning(
"Warning: the `strat` element name of the `variables` list argument to `extract_rsp_biomarkers() ",
"was deprecated in tern 0.9.3.\n ",
"was deprecated in tern 0.9.4.\n ",
"Please use the name `strata` instead of `strat` in the `variables` argument."
)
variables[["strata"]] <- variables[["strat"]]
Expand Down
2 changes: 1 addition & 1 deletion R/response_subgroups.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ extract_rsp_subgroups <- function(variables,
if ("strat" %in% names(variables)) {
warning(
"Warning: the `strat` element name of the `variables` list argument to `extract_rsp_subgroups() ",
"was deprecated in tern 0.9.3.\n ",
"was deprecated in tern 0.9.4.\n ",
"Please use the name `strata` instead of `strat` in the `variables` argument."
)
variables[["strata"]] <- variables[["strat"]]
Expand Down
2 changes: 1 addition & 1 deletion R/survival_biomarkers_subgroups.R
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ extract_survival_biomarkers <- function(variables,
if ("strat" %in% names(variables)) {
warning(
"Warning: the `strat` element name of the `variables` list argument to `extract_survival_biomarkers() ",
"was deprecated in tern 0.9.3.\n ",
"was deprecated in tern 0.9.4.\n ",
"Please use the name `strata` instead of `strat` in the `variables` argument."
)
variables[["strata"]] <- variables[["strat"]]
Expand Down
2 changes: 1 addition & 1 deletion R/survival_coxph_pairwise.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ s_coxph_pairwise <- function(df,
strat = lifecycle::deprecated(),
control = control_coxph()) {
if (lifecycle::is_present(strat)) {
lifecycle::deprecate_warn("0.9.3", "s_coxph_pairwise(strat)", "s_coxph_pairwise(strata)")
lifecycle::deprecate_warn("0.9.4", "s_coxph_pairwise(strat)", "s_coxph_pairwise(strata)")
strata <- strat
}

Expand Down
2 changes: 1 addition & 1 deletion R/survival_duration_subgroups.R
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ extract_survival_subgroups <- function(variables,
if ("strat" %in% names(variables)) {
warning(
"Warning: the `strat` element name of the `variables` list argument to `extract_survival_subgroups() ",
"was deprecated in tern 0.9.3.\n ",
"was deprecated in tern 0.9.4.\n ",
"Please use the name `strata` instead of `strat` in the `variables` argument."
)
variables[["strata"]] <- variables[["strat"]]
Expand Down
4 changes: 2 additions & 2 deletions R/utils_default_stats_formats_labels.R
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ tern_default_labels <- c(
#' @export
summary_formats <- function(type = "numeric", include_pval = FALSE) {
lifecycle::deprecate_warn(
"0.9.5.9005", "summary_formats()",
"0.9.6", "summary_formats()",
details = 'Use get_formats_from_stats(get_stats("analyze_vars_numeric", add_pval = include_pval)) instead'
)
met_grp <- paste0(c("analyze_vars", type), collapse = "_")
Expand All @@ -537,7 +537,7 @@ summary_formats <- function(type = "numeric", include_pval = FALSE) {
#' @export
summary_labels <- function(type = "numeric", include_pval = FALSE) {
lifecycle::deprecate_warn(
"0.9.5.9005", "summary_formats()",
"0.9.6", "summary_formats()",
details = 'Use get_labels_from_stats(get_stats("analyze_vars_numeric", add_pval = include_pval)) instead'
)
met_grp <- paste0(c("analyze_vars", type), collapse = "_")
Expand Down
5 changes: 0 additions & 5 deletions man/argument_convention.Rd

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

8 changes: 1 addition & 7 deletions man/control_lineplot_vars.Rd

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

3 changes: 0 additions & 3 deletions tests/testthat/test-g_lineplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,6 @@ testthat::test_that("g_lineplot xticks, xlim, and ylim arguments work", {

testthat::test_that("control_lineplot_vars works", {
testthat::expect_silent(control_lineplot_vars(group_var = NA))

# Deprecation warnings work
lifecycle::expect_deprecated(lifecycle::expect_deprecated(control_lineplot_vars(strata = NA, cohort_id = NA)))
})

testthat::test_that("g_lineplot works with no strata (group_var) and allows points when only one strata is provided", {
Expand Down

0 comments on commit dfaa310

Please sign in to comment.