has_args: Check a function has specified arguments

Description Usage Arguments Examples

Description

Check a function has specified arguments

Usage

1
2
3
has_args(f, args, exact = FALSE)

f %has_args% args

Arguments

f

a function

args

a character vector of argument names

exact

if TRUE, argument names must match args exactly (order and value); otherwise f just must have at least args in any order

Examples

1
2
3
4
5
has_args(mean, "x")
has_args(mean, "x", exact = TRUE)

see_if(mean %has_args% "x")
see_if(mean %has_args% "y")

Example output

[1] TRUE
[1] FALSE
[1] TRUE
[1] FALSE
attr(,"msg")
[1] "`%has_args%`(f = mean, args = \"y\") is not TRUE"

assertthat documentation built on May 1, 2019, 10:25 p.m.