Skip to contents

Scalar represents a length of 1.

Usage

isNumber(x, nullOk = FALSE)

isScalar(x, nullOk = FALSE)

isScalarAtomic(x, nullOk = FALSE)

isScalarCharacter(x, nullOk = FALSE)

isScalarDouble(x, nullOk = FALSE)

isScalarInteger(x, nullOk = FALSE)

isScalarIntegerish(x, nullOk = FALSE)

isScalarList(x, nullOk = FALSE)

isScalarLogical(x, nullOk = FALSE)

isScalarNumeric(x, nullOk = FALSE)

isScalarVector(x, nullOk = FALSE)

isNonScalar(x)

Arguments

x

Object.

nullOk

logical(1). If set to TRUE, x may also be NULL.

Value

TRUE on success; FALSE on failure, with cause set.

Functions

  • isNumber(): Alias for isScalarNumeric().

Note

Updated 2021-10-08.

Examples

## TRUE ====
isScalar("a")
#> [1] TRUE
isScalarInteger(1L)
#> [1] TRUE
isScalarIntegerish(1)
#> [1] TRUE

## FALSE ====
isScalar(NULL)
#> [1] FALSE
isScalar(c("a", "b"))
#> [1] FALSE