check...: Check that arguments supplied via ... are allowed

View source: R/checks.R

check...R Documentation

Check that arguments supplied via ... are allowed

Description

This function checks that arguments supplied via ... are allowed. This function was written to support other functions, specifically via the return of a helpful error message if arguments that cannot be supplied via ... have been supplied. The function is not intended for general use.

Usage

check...(not_allowed, ...)

Arguments

not_allowed

A character vector of the names of function arguments that are not allowed.

...

Other arguments

Value

The function checks other arguments supplied via ...; if these contain an argument that is not allowed, the function returns an error. Otherwise, nothing is returned.

Author(s)

Edward Lavender

Examples

#### Example (1) Imagine we have a function in wich xlim and ylim cannot be supplied via ...
# Internally, within that function, we can implement check as follows:
pf <- function(...){
      check...(not_allowed = c("xlim", "ylim"),...)
      plot(1:10, 1:10, xlim = c(1, 10), ylim = c(1, 10),...)
      }
# This works:
pf(col = "red")
# This returns an error
## Not run: 
pf(col = "red", xlim = c(1, 15))

## End(Not run)


edwardlavender/utils.add documentation built on Dec. 14, 2024, 8:11 a.m.