assert_order_vars: Is an Argument a List of Order Variables?

Description Usage Arguments Value Author(s) Examples

View source: R/assertions.R

Description

Checks if an argument is a valid list of order variables created using vars()

Usage

1
assert_order_vars(arg, optional = FALSE)

Arguments

arg

A function argument to be checked

optional

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

Value

The function throws an error if arg is not a list of variables or desc() calls created using vars() and returns the input invisibly otherwise.

Author(s)

Stefan Bundfuss

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
example_fun <- function(by_vars) {
  assert_order_vars(by_vars)
}

example_fun(vars(USUBJID, PARAMCD, desc(AVISITN)))

try(example_fun(exprs(USUBJID, PARAMCD)))

try(example_fun(c("USUBJID", "PARAMCD", "VISIT")))

try(example_fun(vars(USUBJID, toupper(PARAMCD), -AVAL)))

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