Learn R Programming

lintr (version 3.0.2)

modify_defaults: Modify lintr defaults

Description

Modify a list of defaults by name, allowing for replacement, deletion and addition of new elements.

Usage

modify_defaults(defaults, ...)

Value

A modified list of elements, sorted by name. To achieve this sort in a platform-independent way, two transformations are applied to the names: (1) replace _ with 0 and (2) convert tolower().

Arguments

defaults

named list of elements to modify.

...

arguments of elements to change. If unnamed, the argument is automatically named. If the named argument already exists in defaults, it is replaced by the new element. If it does not exist, it is added. If the value is NULL, the element is removed.

See Also

linters_with_tags, linters_with_defaults for creating linter lists.

Examples

Run this code
# custom list of undesirable functions:
#    remove sapply (using NULL)
#    add cat (with a accompanying message),
#    add print (unnamed, i.e. with no accompanying message)
#    add return (as taken from all_undesirable_functions)
my_undesirable_functions <- modify_defaults(defaults = default_undesirable_functions,
  sapply=NULL, "cat"="No cat allowed", "print", all_undesirable_functions[["return"]])

Run the code above in your browser using DataLab