-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcheck_args.Rd
48 lines (42 loc) · 1.23 KB
/
check_args.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
39
40
41
42
43
44
45
46
47
48
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/check_args.R
\name{check_args}
\alias{check_args}
\title{Check argument types, length, or dimension}
\usage{
check_args(arg, type, length = NULL, dim = NULL)
}
\arguments{
\item{arg}{An argument to be checked.}
\item{type}{A character vector of candidate argument type.}
\item{length}{A numeric value of argument length or \code{NULL}.}
\item{dim}{A numeric vector of argument dimension or \code{NULL}.}
}
\value{
Check failure detailed error message.
}
\description{
Check argument types, length, or dimension
}
\details{
If \code{type}, \code{length} or \code{dim} is \code{NULL}, the corresponding check will not be executed.
}
\section{Specification}{
\if{latex}{
\itemize{
\item Check if arg is NULL.
\item Extract the type, length and dim information from arg.
\item Compare with target values and report error message if it does not match.
}
}
\if{html}{The contents of this section are shown in PDF user manual only.}
}
\examples{
\dontrun{
tbl <- as.data.frame(matrix(1:9, nrow = 3))
simtrial:::check_args(arg = tbl, type = c("data.frame"))
vec <- c("a", "b", "c")
simtrial:::check_args(arg = vec, type = c("character"), length = 3)
}
}
\keyword{internal}