Learn R Programming

surveillance (version 1.5-4)

isScalar: Checks if the Argument is Scalar

Description

The simple helper function isScalar just checks if its argument is a scalar, i.e. a numeric vector of length 1. It is implemented as length(x) == 1L && is.vector(x, mode = "numeric").

Usage

isScalar(x)

Arguments

x
an R object.

Value

  • A length-one logical vector.

Examples

Run this code
isScalar(TRUE)   # FALSE
isScalar(1:10)   # FALSE
isScalar(pi)     # TRUE

Run the code above in your browser using DataLab