diff --git a/NEWS.md b/NEWS.md index 08d441316..a4d50a156 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ # teal.data 0.6.0.9012 +### Deprecations + +- `get_code(datanames)` `S4` method parameter for `teal_data()` object was soft deprecated. Use `get_code(names)`. + ### Enhancements - `datanames()` diff --git a/R/teal_data-get_code.R b/R/teal_data-get_code.R index d74435bd6..d2be769ef 100644 --- a/R/teal_data-get_code.R +++ b/R/teal_data-get_code.R @@ -1,6 +1,6 @@ #' Get code from `teal_data` object #' -#' Retrieve code from `teal_data` object. +#' #' `r lifecycle::badge("deprecated")` Retrieve code from `teal_data` object. #' #' Retrieve code stored in `@code`, which (in principle) can be used to recreate all objects found in `@env`. #' Use `datanames` to limit the code to one or more of the datasets enumerated in `@datanames`. @@ -104,11 +104,14 @@ #' #' @export setMethod("get_code", signature = "teal_data", definition = function(object, deparse = TRUE, datanames = NULL, ...) { + checkmate::assert_character(datanames, min.len = 1L, null.ok = TRUE) checkmate::assert_flag(deparse) code <- if (!is.null(datanames)) { + warning("get_code(datanames) was deprecated in teal.data 0.6.1, use get_code(names) instead.") get_code_dependency(object@code, datanames, ...) + } else { object@code } diff --git a/man/get_code.Rd b/man/get_code.Rd index 29b3a4134..8ac100eca 100644 --- a/man/get_code.Rd +++ b/man/get_code.Rd @@ -24,7 +24,7 @@ Either a character string or an expression. If \code{datanames} is used to reque only code that \emph{creates} that dataset (not code that uses it) is returned. Otherwise, all contents of \verb{@code}. } \description{ -Retrieve code from \code{teal_data} object. +#' \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Retrieve code from \code{teal_data} object. } \details{ Retrieve code stored in \verb{@code}, which (in principle) can be used to recreate all objects found in \verb{@env}.