Deprecating an argument
Use lifecycle::deprecated()
with lifecycle::deprecate_warn()
.
write_file <- function(x,
file,
append = FALSE,
path = deprecated()) {
if (is_present(path)) {
lifecycle::deprecate_warn("1.4.0", "write_file(path)", "write_file(file)")
file <- path
}
...
}
readr::write_file("hi", path = tempfile("lifecycle-demo-"))
#> Warning: The `path` argument of `write_file()` is deprecated as of readr
#> 1.4.0.
#> ℹ Please use the `file` argument instead.