I\'m updating an old package and shortening a bunch of really long function names. How do I let a user know the the old function has been deprecated? I document everything with
I had this problem for some time and was unable to find a good solution. Then I found this. Still, the above answers are overly complicated for the simple case where one just wants to: 1) add an alias so that older code doesn't stop working, 2) the alias must work with the built-in documentation, and 3) it should be done with roxygen2.
First, add a copy of the function:
old_function_name = new_function_name
Then, where new_function_name()
is defined, add to the roxygen2:
#' @export new_function_name old_function_name
#' @aliases old_function_name
Now the old function works because it is just a copy of the new function, and the documentation works because you set up the alias. The old version is also exported because it is included in the @export
.