assert_varval_list: Is an Argument a Variable-Value List?

Description Usage Arguments Author(s) Examples

View source: R/assertions.R

Description

Checks if the argument is a list of quosures where the expressions are variable-value pairs. The value can be a symbol, a string, a numeric, or NA. More general expression are not allowed.

Usage

1
2
3
4
5
6
7
assert_varval_list(
  arg,
  required_elements = NULL,
  accept_expr = FALSE,
  accept_var = FALSE,
  optional = FALSE
)

Arguments

arg

A function argument to be checked

required_elements

A character vector of names that must be present in arg

accept_expr

Should expressions on the right hand side be accepted?

accept_var

Should unnamed variable names (e.g. vars(USUBJID)) on the right hand side be accepted?

optional

Is the checked parameter optional? If set to FALSE and arg is NULL then an error is thrown.

Author(s)

Stefan Bundfuss, Thomas Neitmann

Examples

1
2
3
4
5
6
example_fun <- function(vars) {
  assert_varval_list(vars)
}
example_fun(vars(DTHDOM = "AE", DTHSEQ = AESEQ))

try(example_fun(vars("AE", DTSEQ = AESEQ)))

epijim/admiral documentation built on Feb. 13, 2022, 12:15 a.m.