lifeCycle: Set the life cycle stage of a function

View source: R/lifecycle.R

lifeCycleR Documentation

Set the life cycle stage of a function

Description

The lifeCycle function is used to set the life cycle stage of a function. It is to be used within the body of the function that is being deprecated or defunct. It is a wrapper around both .Deprecated and .Defunct base R functions.

Usage

lifeCycle(
  newfun = oldfun,
  newpackage,
  package,
  cycle = c("deprecated", "defunct"),
  title = package
)

Arguments

newfun

character(1) The name of the function to use instead. It can be a specific function within another package (e.g., ⁠package::function⁠) or a function in the current package (e.g., function). If newfun is not specified, the calling function oldfun is assumed to be the replacement.

newpackage

character(1) If a function is moved to a new package, the name of the new package can be specified here. This is equivalent to specifying newfun = paste0(newpackage, "::", newfun).

package

character(1) The name of the package where the deprecated or defunct function resides. It corresponds to the package from where the lifeCycle function is called.

cycle

character(1) The life cycle stage of the function. This can be either "deprecated" or "defunct".

title

character(1) The Rd name prefix of the documentation page where deprecated or defunct functions are documented (e.g., "summary" for "summary-deprecated"). By default, the package name is used.

Examples

test_fun <- function() {
    lifeCycle(newfun = "new_test", package = "BiocBaseUtils")
}
tryCatch(
   test_fun(),
   warning = function(w) message(w)
)
test_fun <- function() {
    lifeCycle(
        newfun = "new_test", package = "BiocBaseUtils", cycle = "defunct"
    )
}
tryCatch(
   test_fun(),
   error = function(e) message(e)
)

Bioconductor/BiocDevelUtils documentation built on Oct. 29, 2024, 10:48 p.m.