test_fun: Tests a function by checking if its arguments are declared

Description Usage Arguments Examples

View source: R/test_fun.R

Description

This function verifies whether all of the arguments of another function already have assigned values. If an argument has a default value but there isn't a corresponding variable, it creates that variable.

Usage

1
test_fun(f, force_default = FALSE)

Arguments

f

A function

force_default

Whether or not to assign the default value to arguments that already have assigned values

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 
f <- function(a, b = 3) {
  a * b
}

test_fun(f)
a
b

b <- 5
test_fun(f)
a
b

test_fun(f, TRUE)
a
b

a <- 2
test_fun(f)
a
b

## End(Not run)

abjutils documentation built on Feb. 1, 2022, 9:10 a.m.