add_arg_if: Add defaults to argument list

Description Usage Arguments Value Author(s) Examples

View source: R/tfse.match_arg.r

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.

Author(s)

Michael Wayne Kearney

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)

AlbanSagouis/myToolbox documentation built on Feb. 1, 2021, 1:08 p.m.