formalArgs: Bugfix for formalArgs(def)

Description Usage Arguments Details

View source: R/Fixes-extensions.R

Description

In the methods-package (loaded by default), formalArgs(def) uses the search path from namespace:methods, which can lead to confusing behaviour if you overwrite something, especially as formals(def) DOES use the environment of the caller.

Usage

1

Arguments

def

Either a function, or a character naming a function

Details

Example of different behaviour:
by <- function(a, b ,c) {"Bye-bye!"} formalArgs(by) # As expected, by does not have any quotes names(formals('by')) # Also works as expected methods::formalArgs('by') # Bug: by is found in the base-package formalArgs('by') # Result as expected


EmilBode/EmilMisc documentation built on Feb. 24, 2020, 4:11 p.m.