chkDots: Warn About Extraneous Arguments in the "..." of Its Caller

Description Usage Arguments Author(s) See Also Examples

View source: R/warnings.R

Description

Warn about extraneous arguments in the ... of its caller. A utility to be used e.g., in S3 methods which need a formal ... argument but do not make any use of it. This helps catching user errors in calling the function in question (which is the caller of chkDots().

Usage

1
chkDots(..., which.call = -1, allowed = character(0))

Arguments

...

“the dots”, as passed from the caller.

which.call

passed to sys.call(). A caller may use -2 if the message should mention its caller.

allowed

not yet implemented: character vector of named elements in ... which are “allowed” and hence not warned about.

Author(s)

Martin Maechler, first version outside base, June 2012.

See Also

warning, ....

Examples

1
2
3
4
5
6
7
seq.default ## <- you will see  ' chkDots(...) '

seq(1,5, foo = "bar") # gives warning via chkDots()

## warning with more than one ...-entry:
density.f <- function(x, ...) NextMethod("density")
x <- density(structure(rnorm(10), class="f"), bar=TRUE, baz=TRUE)

robertzk/monadicbase documentation built on May 27, 2019, 10:35 a.m.