-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_value.Rd
38 lines (34 loc) · 1.5 KB
/
check_value.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/utils.R
\name{check_value}
\alias{check_value}
\title{Check the input value to a parent function argument}
\source{
This function is taken from the `utils.add' package (https://github.com/edwardlavender/utils.add). It is defined separately in \code{\link[flapper]{flapper}} to reduce reliance on non-default packages.
}
\usage{
check_value(
arg = deparse(substitute(input)),
input,
supp,
warn = TRUE,
default = supp[1]
)
}
\arguments{
\item{arg}{A character string which defines the argument of the parent function.}
\item{input}{The input to an argument of a parent function.}
\item{supp}{A vector of supported input values for the argument in the parent function.}
\item{warn}{A logical input which defines whether or not to return a warning and the default value (see \code{default}) or an error.}
\item{default}{The default input value for the parent function.}
}
\value{
The function returns \code{input}, an error or a warning and \code{default} depending on whether or not \code{input} is within \code{supp} (i.e., whether or not the input to the argument of a parent function is supported).
}
\description{
Within a function, this function checks the value of an input to an argument of that function. If the input value is supported, the function simply returns this value. If the input is not supported, the function either throws an error or returns a warning and the default value.
}
\author{
Edward Lavender
}
\keyword{internal}