Learn R Programming

spatstat.utils (version 3.2-5)

check.1.integer: Check Argument Type and Length

Description

These utility functions check whether a given argument is a single value of the required type.

Usage

check.1.real(x, context = "", fatal = TRUE, warn=TRUE)
check.1.integer(x, context = "", fatal = TRUE, warn=TRUE)
check.1.string(x, context = "", fatal = TRUE, warn=TRUE)
check.1.logical(x, context = "", fatal = TRUE, warn=TRUE)

Arguments

Value

A logical value (or an error may occur).

Details

These functions check whether the argument x is a single atomic value of type numeric, integer, character or logical.

If x does have the required length and type, the result of the function is the logical value TRUE.

Otherwise, if fatal=TRUE (the default) an error occurs, while if fatal=FALSE a warning is issued (if warn=TRUE) and the function returns the value FALSE.

See Also

check.named.vector

Examples

Run this code
  x <- pi
  check.1.real(x)
  check.1.integer(pi, fatal=FALSE, context="In your dreams,")
  check.1.string(x, fatal=FALSE)
  check.1.integer(x, fatal=FALSE, warn=FALSE)
  check.1.logical(pi, fatal=FALSE, warn=FALSE)

Run the code above in your browser using DataLab