Deprecating a function
Inform your user that they’re using a deprecated feature by using the lifecycle::deprecate_warn()
every 8 hours or always if always = TRUE
.
If you only wants to inform to a package maintainer you can use lifecycle::deprecate_soft()
as an alternative.
# old function
plus3 <- function(x, y, z) {
lifecycle::deprecate_warn("1.0.0", "plus3()", "add3()")
add3(x, y, z)
}
plus3(1, 2, 3)
#> Warning: `plus3()` was deprecated in somepackage 1.0.0.
#> ℹ Please use `add3()` instead.
#> [1] 6
Note: If you’re using base R only, the .Deprecated()
and .Defunct()
can be used.