dot-Deprecate: Deprecate Functions and Arguments

.DeprecateR Documentation

Deprecate Functions and Arguments

Description

Provides automatic deprecation and defunctation of functions and arguments;

Usage

.Deprecate(
  when,
  what,
  with = NULL,
  ...,
  pkg = NULL,
  env = missing_arg(),
  user_env = missing_arg()
)

Arguments

when

A string giving the version when the behaviour was deprecated.

what

A string describing what is deprecated:

  • Deprecate a whole function with "foo()".

  • Deprecate an argument with "foo(arg)".

  • Partially deprecate an argument with "foo(arg = 'must be a scalar integer')".

  • Deprecate anything else with a custom message by wrapping it in I().

You can optionally supply the namespace: "ns::foo()", but this is usually not needed as it will be inferred from the caller environment.

with

An optional string giving a recommended replacement for the deprecated behaviour. This takes the same form as what.

...

Arguments passed on to lifecycle::deprecate_soft

details

In most cases the deprecation message can be automatically generated from with. When it can't, use details to provide a hand-written message.

details can either be a single string or a character vector, which will be converted to a bulleted list. By default, info bullets are used. Provide a named vectors to override.

id

The id of the deprecation. A warning is issued only once for each id. Defaults to the generated message, but you should give a unique ID when the message in details is built programmatically and depends on inputs, or when you'd like to deprecate multiple functions but warn only once for all of them.

env,user_env

Pair of environments that define where ⁠deprecate_*()⁠ was called (used to determine the package name) and where the function called the deprecating function was called (used to determine if deprecate_soft() should message).

These are only needed if you're calling ⁠deprecate_*()⁠ from an internal helper, in which case you should forward env = caller_env() and user_env = caller_env(2).

pkg

Name of package to use for comparison

env, user_env

Managed internally by .Deprecate()

Value

Run for its side effect and invisibly returns NULL

See Also

lifecycle::deprecate_soft() lifecycle::deprecate_warn() lifecycle::deprecate_stop()


SeuratObject documentation built on May 29, 2024, 12:31 p.m.