add_arg_if: Add defaults to argument list

Description Usage Arguments Value Examples

Description

Adds parameters to argument list if list does not already include those parameters

Usage

1
add_arg_if(args, ..., override = FALSE)

Arguments

args

Argument list

...

Other named arguments are added (depending on override) and returned with args

override

Logical indicating whether to override existing values in args with the values provided as a named argument here.

Value

Argument list with updated values.

Examples

1
2
3
4
5
6
7
8
## arg list
args <- list(x = 5, y = TRUE, z = FALSE)

## add arg defaults
add_arg_if(args, w = TRUE, z = TRUE)

## add arg defaults, overriding any previous values
add_arg_if(args, x = 10, z = TRUE, override = TRUE)

mkearney/tfse documentation built on July 6, 2019, 3:18 a.m.