jakub jakub - 1 year ago 90
R Question

How to deprecate an argument?

Is there a standard way of deprecating arguments in R?

Example: For a web API package, I previously included a

argument which would paginate over all the results and download everything.

Now I want to have a
argument instead, and only download everything if set to
. This effectively eliminates the need for the
argument, so I need to let people now it basically does nothing now. How do I do that?

Answer Source

Something like as follows maybe would do for you?

foo <- function(paging = T, limit = 0) {
  if (!missing("paging"))
    warning("argument deprecated")

Example outputs:

# > foo()
# > foo(limit = 0)
# > foo(T)
# Warning message:
#   In foo(T) : argument deprecated
# > foo(paging = T)
# Warning message:
#   In foo(paging = T) : argument deprecated
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download