File: validate_that.Rd

package info (click to toggle)
r-cran-assertthat 0.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 220 kB
  • sloc: sh: 9; makefile: 2
file content (41 lines) | stat: -rw-r--r-- 1,244 bytes parent folder | download | duplicates (3)
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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/validate-that.R
\name{validate_that}
\alias{validate_that}
\title{Validate that certain conditions are true.}
\usage{
validate_that(..., env = parent.frame(), msg = NULL)
}
\arguments{
\item{...}{unnamed expressions that describe the conditions to be tested.
Rather than combining expressions with \code{&&}, separate them by commas
so that better error messages can be generated.}

\item{env}{(advanced use only) the environment in which to evaluate the
assertions.}

\item{msg}{a custom error message to be printed if one of the conditions is
false.}
}
\value{
A \code{character} vector if the assertion is false, or \code{TRUE}
if the assertion is true.
}
\description{
\code{validate_that} is an alternative to the function
\code{\link{assert_that}}, that returns a \code{character} vector. This
makes them easier to use within S4 \code{"validate"} methods.
}
\examples{
x <- 1
# assert_that() generates errors, so can't be usefully run in
# examples
validate_that(is.numeric(x))
validate_that(is.character(x))
validate_that(length(x) == 3)
validate_that(is.dir("asdf"))
}
\seealso{
\code{\link{assert_that}}, which returns an error if the condition
is false.
}