From eaf8ec806a01c57e06012040bc33974b566b382f Mon Sep 17 00:00:00 2001 From: Emily de la Rua <emily.de_la_rua@contractors.roche.com> Date: Wed, 8 May 2024 16:32:12 -0400 Subject: [PATCH 1/5] Implement lifecycle --- DESCRIPTION | 2 +- NAMESPACE | 1 + R/package.R | 1 + man/figures/lifecycle-archived.svg | 21 ++++++++++++++++ man/figures/lifecycle-defunct.svg | 21 ++++++++++++++++ man/figures/lifecycle-deprecated.svg | 21 ++++++++++++++++ man/figures/lifecycle-experimental.svg | 21 ++++++++++++++++ man/figures/lifecycle-maturing.svg | 21 ++++++++++++++++ man/figures/lifecycle-questioning.svg | 21 ++++++++++++++++ man/figures/lifecycle-soft-deprecated.svg | 21 ++++++++++++++++ man/figures/lifecycle-stable.svg | 29 +++++++++++++++++++++++ man/figures/lifecycle-superseded.svg | 21 ++++++++++++++++ 12 files changed, 200 insertions(+), 1 deletion(-) create mode 100644 man/figures/lifecycle-archived.svg create mode 100644 man/figures/lifecycle-defunct.svg create mode 100644 man/figures/lifecycle-deprecated.svg create mode 100644 man/figures/lifecycle-experimental.svg create mode 100644 man/figures/lifecycle-maturing.svg create mode 100644 man/figures/lifecycle-questioning.svg create mode 100644 man/figures/lifecycle-soft-deprecated.svg create mode 100644 man/figures/lifecycle-stable.svg create mode 100644 man/figures/lifecycle-superseded.svg diff --git a/DESCRIPTION b/DESCRIPTION index 64fcdc474..301f88678 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -36,6 +36,7 @@ Depends: Imports: checkmate (>= 2.1.0), htmltools (>= 0.5.4), + lifecycle (>= 0.2.0), stats, stringi (>= 1.6) Suggests: @@ -44,7 +45,6 @@ Suggests: dplyr (>= 1.0.5), flextable (>= 0.8.4), knitr (>= 1.42), - lifecycle (>= 0.2.0), officer (>= 0.5.0), r2rtf (>= 0.3.2), rmarkdown (>= 2.19), diff --git a/NAMESPACE b/NAMESPACE index b207dee29..63e320dec 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -288,6 +288,7 @@ importFrom(formatters,export_as_pdf) importFrom(formatters,export_as_txt) importFrom(htmltools,tagList) importFrom(htmltools,tags) +importFrom(lifecycle,deprecated) importFrom(magrittr,"%>%") importFrom(stats,binom.test) importFrom(stats,na.omit) diff --git a/R/package.R b/R/package.R index 53c42924a..8b79f426b 100644 --- a/R/package.R +++ b/R/package.R @@ -4,6 +4,7 @@ #' @importFrom utils head head.matrix tail tail.matrix #' @importFrom stats setNames na.omit prop.test binom.test relevel quantile #' @importFrom htmltools tags tagList +#' @importFrom lifecycle deprecated #' @importFrom magrittr %>% #' @import methods NULL diff --git a/man/figures/lifecycle-archived.svg b/man/figures/lifecycle-archived.svg new file mode 100644 index 000000000..745ab0c78 --- /dev/null +++ b/man/figures/lifecycle-archived.svg @@ -0,0 +1,21 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="112" height="20" role="img" aria-label="lifecycle: archived"> + <title>lifecycle: archived</title> + <linearGradient id="s" x2="0" y2="100%"> + <stop offset="0" stop-color="#bbb" stop-opacity=".1" /> + <stop offset="1" stop-opacity=".1" /> + </linearGradient> + <clipPath id="r"> + <rect width="112" height="20" rx="3" fill="#fff" /> + </clipPath> + <g clip-path="url(#r)"> + <rect width="55" height="20" fill="#555" /> + <rect x="55" width="57" height="20" fill="#e05d44" /> + <rect width="112" height="20" fill="url(#s)" /> + </g> + <g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"> + <text aria-hidden="true" x="285" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="450">lifecycle</text> + <text x="285" y="140" transform="scale(.1)" fill="#fff" textLength="450">lifecycle</text> + <text aria-hidden="true" x="825" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="470">archived</text> + <text x="825" y="140" transform="scale(.1)" fill="#fff" textLength="470">archived</text> + </g> +</svg> diff --git a/man/figures/lifecycle-defunct.svg b/man/figures/lifecycle-defunct.svg new file mode 100644 index 000000000..d5c9559ed --- /dev/null +++ b/man/figures/lifecycle-defunct.svg @@ -0,0 +1,21 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="106" height="20" role="img" aria-label="lifecycle: defunct"> + <title>lifecycle: defunct</title> + <linearGradient id="s" x2="0" y2="100%"> + <stop offset="0" stop-color="#bbb" stop-opacity=".1" /> + <stop offset="1" stop-opacity=".1" /> + </linearGradient> + <clipPath id="r"> + <rect width="106" height="20" rx="3" fill="#fff" /> + </clipPath> + <g clip-path="url(#r)"> + <rect width="55" height="20" fill="#555" /> + <rect x="55" width="51" height="20" fill="#fe7d37" /> + <rect width="106" height="20" fill="url(#s)" /> + </g> + <g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"> + <text aria-hidden="true" x="285" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="450">lifecycle</text> + <text x="285" y="140" transform="scale(.1)" fill="#fff" textLength="450">lifecycle</text> + <text aria-hidden="true" x="795" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="410">defunct</text> + <text x="795" y="140" transform="scale(.1)" fill="#fff" textLength="410">defunct</text> + </g> +</svg> diff --git a/man/figures/lifecycle-deprecated.svg b/man/figures/lifecycle-deprecated.svg new file mode 100644 index 000000000..b61c57c3f --- /dev/null +++ b/man/figures/lifecycle-deprecated.svg @@ -0,0 +1,21 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="126" height="20" role="img" aria-label="lifecycle: deprecated"> + <title>lifecycle: deprecated</title> + <linearGradient id="s" x2="0" y2="100%"> + <stop offset="0" stop-color="#bbb" stop-opacity=".1" /> + <stop offset="1" stop-opacity=".1" /> + </linearGradient> + <clipPath id="r"> + <rect width="126" height="20" rx="3" fill="#fff" /> + </clipPath> + <g clip-path="url(#r)"> + <rect width="55" height="20" fill="#555" /> + <rect x="55" width="71" height="20" fill="#fe7d37" /> + <rect width="126" height="20" fill="url(#s)" /> + </g> + <g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"> + <text aria-hidden="true" x="285" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="450">lifecycle</text> + <text x="285" y="140" transform="scale(.1)" fill="#fff" textLength="450">lifecycle</text> + <text aria-hidden="true" x="895" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="610">deprecated</text> + <text x="895" y="140" transform="scale(.1)" fill="#fff" textLength="610">deprecated</text> + </g> +</svg> diff --git a/man/figures/lifecycle-experimental.svg b/man/figures/lifecycle-experimental.svg new file mode 100644 index 000000000..5d88fc2c6 --- /dev/null +++ b/man/figures/lifecycle-experimental.svg @@ -0,0 +1,21 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="138" height="20" role="img" aria-label="lifecycle: experimental"> + <title>lifecycle: experimental</title> + <linearGradient id="s" x2="0" y2="100%"> + <stop offset="0" stop-color="#bbb" stop-opacity=".1" /> + <stop offset="1" stop-opacity=".1" /> + </linearGradient> + <clipPath id="r"> + <rect width="138" height="20" rx="3" fill="#fff" /> + </clipPath> + <g clip-path="url(#r)"> + <rect width="55" height="20" fill="#555" /> + <rect x="55" width="83" height="20" fill="#fe7d37" /> + <rect width="138" height="20" fill="url(#s)" /> + </g> + <g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"> + <text aria-hidden="true" x="285" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="450">lifecycle</text> + <text x="285" y="140" transform="scale(.1)" fill="#fff" textLength="450">lifecycle</text> + <text aria-hidden="true" x="955" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="730">experimental</text> + <text x="955" y="140" transform="scale(.1)" fill="#fff" textLength="730">experimental</text> + </g> +</svg> diff --git a/man/figures/lifecycle-maturing.svg b/man/figures/lifecycle-maturing.svg new file mode 100644 index 000000000..897370ecf --- /dev/null +++ b/man/figures/lifecycle-maturing.svg @@ -0,0 +1,21 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="116" height="20" role="img" aria-label="lifecycle: maturing"> + <title>lifecycle: maturing</title> + <linearGradient id="s" x2="0" y2="100%"> + <stop offset="0" stop-color="#bbb" stop-opacity=".1" /> + <stop offset="1" stop-opacity=".1" /> + </linearGradient> + <clipPath id="r"> + <rect width="116" height="20" rx="3" fill="#fff" /> + </clipPath> + <g clip-path="url(#r)"> + <rect width="55" height="20" fill="#555" /> + <rect x="55" width="61" height="20" fill="#007ec6" /> + <rect width="116" height="20" fill="url(#s)" /> + </g> + <g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"> + <text aria-hidden="true" x="285" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="450">lifecycle</text> + <text x="285" y="140" transform="scale(.1)" fill="#fff" textLength="450">lifecycle</text> + <text aria-hidden="true" x="845" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">maturing</text> + <text x="845" y="140" transform="scale(.1)" fill="#fff" textLength="510">maturing</text> + </g> +</svg> diff --git a/man/figures/lifecycle-questioning.svg b/man/figures/lifecycle-questioning.svg new file mode 100644 index 000000000..7c1721d05 --- /dev/null +++ b/man/figures/lifecycle-questioning.svg @@ -0,0 +1,21 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="20" role="img" aria-label="lifecycle: questioning"> + <title>lifecycle: questioning</title> + <linearGradient id="s" x2="0" y2="100%"> + <stop offset="0" stop-color="#bbb" stop-opacity=".1" /> + <stop offset="1" stop-opacity=".1" /> + </linearGradient> + <clipPath id="r"> + <rect width="128" height="20" rx="3" fill="#fff" /> + </clipPath> + <g clip-path="url(#r)"> + <rect width="55" height="20" fill="#555" /> + <rect x="55" width="73" height="20" fill="#007ec6" /> + <rect width="128" height="20" fill="url(#s)" /> + </g> + <g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"> + <text aria-hidden="true" x="285" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="450">lifecycle</text> + <text x="285" y="140" transform="scale(.1)" fill="#fff" textLength="450">lifecycle</text> + <text aria-hidden="true" x="905" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="630">questioning</text> + <text x="905" y="140" transform="scale(.1)" fill="#fff" textLength="630">questioning</text> + </g> +</svg> diff --git a/man/figures/lifecycle-soft-deprecated.svg b/man/figures/lifecycle-soft-deprecated.svg new file mode 100644 index 000000000..9c166ff30 --- /dev/null +++ b/man/figures/lifecycle-soft-deprecated.svg @@ -0,0 +1,21 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="152" height="20" role="img" aria-label="lifecycle: soft-deprecated"> + <title>lifecycle: soft-deprecated</title> + <linearGradient id="s" x2="0" y2="100%"> + <stop offset="0" stop-color="#bbb" stop-opacity=".1" /> + <stop offset="1" stop-opacity=".1" /> + </linearGradient> + <clipPath id="r"> + <rect width="152" height="20" rx="3" fill="#fff" /> + </clipPath> + <g clip-path="url(#r)"> + <rect width="55" height="20" fill="#555" /> + <rect x="55" width="97" height="20" fill="#007ec6" /> + <rect width="152" height="20" fill="url(#s)" /> + </g> + <g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"> + <text aria-hidden="true" x="285" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="450">lifecycle</text> + <text x="285" y="140" transform="scale(.1)" fill="#fff" textLength="450">lifecycle</text> + <text aria-hidden="true" x="1025" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="870">soft-deprecated</text> + <text x="1025" y="140" transform="scale(.1)" fill="#fff" textLength="870">soft-deprecated</text> + </g> +</svg> diff --git a/man/figures/lifecycle-stable.svg b/man/figures/lifecycle-stable.svg new file mode 100644 index 000000000..9bf21e76b --- /dev/null +++ b/man/figures/lifecycle-stable.svg @@ -0,0 +1,29 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="98" height="20" role="img" aria-label="lifecycle: stable"> + <title>lifecycle: stable</title> + <linearGradient id="s" x2="0" y2="100%"> + <stop offset="0" stop-color="#bbb" stop-opacity=".1" /> + <stop offset="1" stop-opacity=".1" /> + </linearGradient> + <clipPath id="r"> + <rect width="98" height="20" rx="3" fill="#fff" /> + </clipPath> + <g clip-path="url(#r)"> + <rect width="55" height="20" fill="#555" /> + <rect x="55" width="43" height="20" fill="#4c1" /> + <rect width="98" height="20" fill="url(#s)" /> + </g> + <g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"> + <text aria-hidden="true" x="285" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="450"> + lifecycle + </text> + <text x="285" y="140" transform="scale(.1)" fill="#fff" textLength="450"> + lifecycle + </text> + <text aria-hidden="true" x="755" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="330"> + stable + </text> + <text x="755" y="140" transform="scale(.1)" fill="#fff" textLength="330"> + stable + </text> + </g> +</svg> diff --git a/man/figures/lifecycle-superseded.svg b/man/figures/lifecycle-superseded.svg new file mode 100644 index 000000000..db8d757f7 --- /dev/null +++ b/man/figures/lifecycle-superseded.svg @@ -0,0 +1,21 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="20" role="img" aria-label="lifecycle: superseded"> + <title>lifecycle: superseded</title> + <linearGradient id="s" x2="0" y2="100%"> + <stop offset="0" stop-color="#bbb" stop-opacity=".1" /> + <stop offset="1" stop-opacity=".1" /> + </linearGradient> + <clipPath id="r"> + <rect width="128" height="20" rx="3" fill="#fff" /> + </clipPath> + <g clip-path="url(#r)"> + <rect width="55" height="20" fill="#555" /> + <rect x="55" width="73" height="20" fill="#007ec6" /> + <rect width="128" height="20" fill="url(#s)" /> + </g> + <g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"> + <text aria-hidden="true" x="285" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="450">lifecycle</text> + <text x="285" y="140" transform="scale(.1)" fill="#fff" textLength="450">lifecycle</text> + <text aria-hidden="true" x="905" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="630">superseded</text> + <text x="905" y="140" transform="scale(.1)" fill="#fff" textLength="630">superseded</text> + </g> +</svg> From bc8010ab7690361121ca51c8f1ece809b0aab893 Mon Sep 17 00:00:00 2001 From: Emily de la Rua <emily.de_la_rua@contractors.roche.com> Date: Wed, 8 May 2024 16:35:09 -0400 Subject: [PATCH 2/5] Add to precommit config --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8996c9173..64f6f0a76 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,6 +15,7 @@ repos: - methods - checkmate - htmltools + - lifecycle - stats - stringi - id: use-tidy-description From 5123211d037510d799e7388f325ccf84aadf98cd Mon Sep 17 00:00:00 2001 From: Emily de la Rua <emily.de_la_rua@contractors.roche.com> Date: Wed, 8 May 2024 17:24:23 -0400 Subject: [PATCH 3/5] Add lifecycle deprecation messages/badges --- NEWS.md | 2 ++ R/colby_constructors.R | 17 +++++++++++----- R/tree_accessors.R | 16 ++++++++-------- R/tt_compatibility.R | 33 ++++++++++++++++++++++---------- R/tt_dotabulation.R | 2 +- man/build_table.Rd | 2 +- man/insert_rrow.Rd | 5 ++++- man/rbind.Rd | 6 +++++- tests/testthat/test-binding.R | 4 ++-- tests/testthat/test-deprecated.R | 6 +++--- 10 files changed, 61 insertions(+), 32 deletions(-) diff --git a/NEWS.md b/NEWS.md index a0da1b59c..498590b92 100644 --- a/NEWS.md +++ b/NEWS.md @@ -15,6 +15,8 @@ ### Miscellaneous * Removed deprecated functions `add_analyzed_var` and `trim_zero_rows`. + * Added `lifecycle` badge files for documentation. + * Deprecated the `gap` and `check_headers` arguments to `rbindl_rtables` using `lifecycle`. ## rtables 0.6.6 ### New Features diff --git a/R/colby_constructors.R b/R/colby_constructors.R index d7105a93d..fc43a32d7 100644 --- a/R/colby_constructors.R +++ b/R/colby_constructors.R @@ -46,7 +46,12 @@ setGeneric( #' @rdname int_methods setMethod("split_rows", "NULL", function(lyt, spl, pos, cmpnd_fun = AnalyzeMultiVars) { - .Deprecated(msg = "Initializing layouts via NULL is deprecated, please use basic_table() instead") + lifecycle::deprecate_warn( + when = "0.3.8", + what = I("split_rows(NULL)"), + with = "basic_table()", + details = "Initializing layouts via `NULL` is no longer supported." + ) rl <- PreDataRowLayout(SplitVector(spl)) cl <- PreDataColLayout() PreDataTableLayouts(rlayout = rl, clayout = cl) @@ -208,10 +213,12 @@ setGeneric( #' @rdname int_methods setMethod("split_cols", "NULL", function(lyt, spl, pos) { - .Deprecated(msg = paste( - "Initializing layouts via NULL is deprecated,", - "please use basic_table() instead" - )) + lifecycle::deprecate_warn( + when = "0.3.8", + what = I("split_cols(NULL)"), + with = "basic_table()", + details = "Initializing layouts via `NULL` is no longer supported." + ) cl <- PreDataColLayout(SplitVector(spl)) rl <- PreDataRowLayout() PreDataTableLayouts(rlayout = rl, clayout = cl) diff --git a/R/tree_accessors.R b/R/tree_accessors.R index 8b447db58..312f4fb1f 100644 --- a/R/tree_accessors.R +++ b/R/tree_accessors.R @@ -3001,10 +3001,10 @@ setGeneric("col_fnotes_here", function(obj) standardGeneric("col_fnotes_here")) #' @export #' @rdname ref_fnotes setMethod("col_fnotes_here", "ANY", function(obj) { - .Deprecated( - new = "col_footnotes", - old = "col_fnotes_here", - msg = "col_fnotes_here was deprecated in {rtables} version 0.6.5.9011. Please use col_footnotes instead." + lifecycle::deprecate_warn( + when = "0.6.6", + what = "col_fnotes_here()", + with = "col_footnotes()" ) col_footnotes(obj) }) @@ -3016,10 +3016,10 @@ setGeneric("col_fnotes_here<-", function(obj, value) standardGeneric("col_fnotes #' @export #' @rdname int_methods setMethod("col_fnotes_here<-", "ANY", function(obj, value) { - .Deprecated( - new = "col_footnotes<-", - old = "col_fnotes_here<-", - msg = "col_fnotes_here<- was deprecated in {rtables} version 0.6.5.9011. Please use col_footnotes<- instead." + lifecycle::deprecate_warn( + when = "0.6.6", + what = I("col_fnotes_here()<-"), + with = I("col_footnotes()<-") ) col_footnotes(obj) <- value }) diff --git a/R/tt_compatibility.R b/R/tt_compatibility.R index 35e42dab1..bc8ee4df2 100644 --- a/R/tt_compatibility.R +++ b/R/tt_compatibility.R @@ -383,9 +383,18 @@ only_first_annot <- function(all_annots) { #' @rdname rbind #' @aliases rbind #' @export -rbindl_rtables <- function(x, gap = 0, check_headers = TRUE) { - if (!check_headers) { - warning("check_headers = FALSE is no longer supported, ignoring.") +rbindl_rtables <- function(x, gap = lifecycle::deprecated(), check_headers = lifecycle::deprecated()) { + if (lifecycle::is_present(gap)) { + lifecycle::deprecate_warn( + when = "0.3.2", + what = "rbindl_rtables(gap)" + ) + } + if (lifecycle::is_present(check_headers)) { + lifecycle::deprecate_warn( + when = "0.3.2", + what = "rbindl_rtables(check_headers)" + ) } firstcols <- col_info(x[[1]]) @@ -507,7 +516,7 @@ rbindl_rtables <- function(x, gap = 0, check_headers = TRUE) { setMethod( "rbind", "VTableNodeInfo", function(..., deparse.level = 1) { - rbindl_rtables(list(...), check_headers = TRUE) + rbindl_rtables(list(...)) } ) @@ -530,7 +539,7 @@ setMethod( setMethod( "rbind2", "VTableNodeInfo", function(x, y) { - rbindl_rtables(list(x, y), check_headers = TRUE) + rbindl_rtables(list(x, y)) } ) @@ -926,7 +935,9 @@ chk_compat_cinfos <- function(tt1, tt2) { } -#' **Deprecated:** Insert `rrow`s at (before) a specific location +#' Insert `rrow`s at (before) a specific location +#' +#' `r lifecycle::badge("deprecated")` #' #' This function is deprecated and will be removed in a future release of `rtables`. Please use #' [insert_row_at_path()] or [label_at_path()] instead. @@ -973,7 +984,11 @@ chk_compat_cinfos <- function(tt1, tt2) { #' @export insert_rrow <- function(tbl, rrow, at = 1, ascontent = FALSE) { - .Deprecated("insert_row_at_path or label_at_path(tab)<-", old = "insert_rrow") + lifecycle::deprecate_warn( + when = "0.4.0", + what = "insert_rrow()", + with = I("insert_row_at_path() or label_at_path()") + ) stopifnot( is(tbl, "VTableTree"), is(rrow, "TableRow"), @@ -985,9 +1000,7 @@ insert_rrow <- function(tbl, rrow, at = 1, } if (at == 1) { - return(rbindl_rtables(list(rrow, tbl), - check_headers = TRUE - )) + return(rbindl_rtables(list(rrow, tbl))) } else if (at == nrow(tbl) + 1) { return(rbind2(tbl, rrow)) } diff --git a/R/tt_dotabulation.R b/R/tt_dotabulation.R index 791b0a9ae..903f12eb4 100644 --- a/R/tt_dotabulation.R +++ b/R/tt_dotabulation.R @@ -1132,7 +1132,7 @@ recursive_applysplit <- function(df, #' #' @inheritParams gen_args #' @inheritParams lyt_args -#' @param col_counts (`numeric` or `NULL`)\cr `r lifecycle::badge("deprecated")` if non-`NULL`, column counts +#' @param col_counts (`numeric` or `NULL`)\cr if non-`NULL`, column counts #' which override those calculated automatically during tabulation. Must specify "counts" for *all* #' resulting columns if non-`NULL`. `NA` elements will be replaced with the automatically calculated counts. #' @param col_total (`integer(1)`)\cr the total observations across all columns. Defaults to `nrow(df)`. diff --git a/man/build_table.Rd b/man/build_table.Rd index 37869f8b0..0ebaef7b9 100644 --- a/man/build_table.Rd +++ b/man/build_table.Rd @@ -23,7 +23,7 @@ build_table( \item{alt_counts_df}{(\code{data.frame} or \code{tibble})\cr alternative full dataset the rtables framework will use \emph{only} when calculating column counts.} -\item{col_counts}{(\code{numeric} or \code{NULL})\cr \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} if non-\code{NULL}, column counts +\item{col_counts}{(\code{numeric} or \code{NULL})\cr if non-\code{NULL}, column counts which override those calculated automatically during tabulation. Must specify "counts" for \emph{all} resulting columns if non-\code{NULL}. \code{NA} elements will be replaced with the automatically calculated counts.} diff --git a/man/insert_rrow.Rd b/man/insert_rrow.Rd index 6d8d11908..6a25aa49f 100644 --- a/man/insert_rrow.Rd +++ b/man/insert_rrow.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/tt_compatibility.R \name{insert_rrow} \alias{insert_rrow} -\title{\strong{Deprecated:} Insert \code{rrow}s at (before) a specific location} +\title{Insert \code{rrow}s at (before) a specific location} \usage{ insert_rrow(tbl, rrow, at = 1, ascontent = FALSE) } @@ -19,6 +19,9 @@ insert_rrow(tbl, rrow, at = 1, ascontent = FALSE) A \code{TableTree} of the same specific class as \code{tbl}. } \description{ +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} +} +\details{ This function is deprecated and will be removed in a future release of \code{rtables}. Please use \code{\link[=insert_row_at_path]{insert_row_at_path()}} or \code{\link[=label_at_path]{label_at_path()}} instead. } diff --git a/man/rbind.Rd b/man/rbind.Rd index 60ae7be46..b8c5dcde1 100644 --- a/man/rbind.Rd +++ b/man/rbind.Rd @@ -7,7 +7,11 @@ \alias{rbind2,VTableNodeInfo,ANY-method} \title{Row-bind \code{TableTree} and related objects} \usage{ -rbindl_rtables(x, gap = 0, check_headers = TRUE) +rbindl_rtables( + x, + gap = lifecycle::deprecated(), + check_headers = lifecycle::deprecated() +) \S4method{rbind}{VTableNodeInfo}(..., deparse.level = 1) diff --git a/tests/testthat/test-binding.R b/tests/testthat/test-binding.R index 43c8d252f..67fe271f2 100644 --- a/tests/testthat/test-binding.R +++ b/tests/testthat/test-binding.R @@ -166,9 +166,9 @@ test_that("insert_rrow works", { build_table(ex_adsl) ## column numbers don't match - expect_error(suppressWarnings(insert_rrow(tbl, rrow("Total xx", ""), at = 1))) + expect_error(lifecycle::expect_deprecated(insert_rrow(tbl, rrow("Total xx", ""), at = 1))) ## this is ok cause its a LabelRow not a DataRow - expect_silent(suppressWarnings(insert_rrow(tbl, rrow("Total xx"), at = 1))) + expect_silent(lifecycle::expect_deprecated(insert_rrow(tbl, rrow("Total xx"), at = 1))) }) ## regression test for #340 diff --git a/tests/testthat/test-deprecated.R b/tests/testthat/test-deprecated.R index cbd701c8b..37b4f81cd 100644 --- a/tests/testthat/test-deprecated.R +++ b/tests/testthat/test-deprecated.R @@ -2,9 +2,9 @@ context("deprecated functionality") test_that("deprecated things are still there and work kinda", { - expect_warning(lyt11 <- split_cols_by(lyt = NULL, "ARM"), "deprecated") + lifecycle::expect_deprecated(lyt11 <- split_cols_by(lyt = NULL, "ARM")) expect_identical(lyt11, basic_table() %>% split_cols_by("ARM")) - expect_warning(lyt22 <- split_rows_by(lyt = NULL, "ARM"), "deprecated") + lifecycle::expect_deprecated(lyt22 <- split_rows_by(lyt = NULL, "ARM")) expect_identical(lyt22, basic_table() %>% split_rows_by("ARM")) }) @@ -14,7 +14,7 @@ test_that("deprecated insert_rrow still currently works", { analyze("Sepal.Length") %>% build_table(iris) - expect_warning(res1 <- insert_rrow(tbl, rrow("Hello World")), "Deprecated") + lifecycle::expect_deprecated(res1 <- insert_rrow(tbl, rrow("Hello World"))) realdf <- make_row_df(tbl) o <- options(warn = -1) mf1 <- matrix_form(res1) From 15da740afc561053a9d31c075f4838eabb4bb827 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 8 May 2024 21:28:28 +0000 Subject: [PATCH 4/5] [skip style] [skip vbump] Restyle files --- R/tt_compatibility.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tt_compatibility.R b/R/tt_compatibility.R index bc8ee4df2..85959a126 100644 --- a/R/tt_compatibility.R +++ b/R/tt_compatibility.R @@ -936,7 +936,7 @@ chk_compat_cinfos <- function(tt1, tt2) { #' Insert `rrow`s at (before) a specific location -#' +#' #' `r lifecycle::badge("deprecated")` #' #' This function is deprecated and will be removed in a future release of `rtables`. Please use From 4fe287a7d89cc18420000790a9a0a677467fece1 Mon Sep 17 00:00:00 2001 From: Emily de la Rua <emily.de_la_rua@contractors.roche.com> Date: Thu, 9 May 2024 14:54:10 -0400 Subject: [PATCH 5/5] Empty commit