forked from pharmaverse/admiral
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassert_order_vars.Rd
38 lines (33 loc) · 1.02 KB
/
assert_order_vars.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/assertions.R
\name{assert_order_vars}
\alias{assert_order_vars}
\title{Is an Argument a List of Order Variables?}
\usage{
assert_order_vars(arg, optional = FALSE)
}
\arguments{
\item{arg}{A function argument to be checked}
\item{optional}{Is the checked parameter optional? If set to \code{FALSE} and \code{arg}
is \code{NULL} then an error is thrown}
}
\value{
The function throws an error if \code{arg} is not a list of variables or \code{desc()}
calls created using \code{vars()} and returns the input invisibly otherwise.
}
\description{
Checks if an argument is a valid list of order variables created using \code{vars()}
}
\examples{
example_fun <- function(by_vars) {
assert_order_vars(by_vars)
}
example_fun(vars(USUBJID, PARAMCD, desc(AVISITN)))
try(example_fun(rlang::exprs(USUBJID, PARAMCD)))
try(example_fun(c("USUBJID", "PARAMCD", "VISIT")))
try(example_fun(vars(USUBJID, toupper(PARAMCD), -AVAL)))
}
\author{
Stefan Bundfuss
}
\keyword{assertion}