More specific functions for scalars of a given type exist, too.
isScalarValue(x, na.ok = TRUE, null.ok = FALSE, type = "atomic")isScalarLogical(x, na.ok = TRUE, null.ok = FALSE)
isScalarNumeric(x, na.ok = TRUE, null.ok = FALSE)
isScalarInteger(x, na.ok = TRUE, null.ok = FALSE)
isScalarComplex(x, na.ok = TRUE, null.ok = FALSE)
isScalarCharacter(x, na.ok = TRUE, null.ok = FALSE)
isScalarFactor(x, na.ok = TRUE, null.ok = FALSE)
[logical(1)
].
[any]
Argument.
[logical(1)
]
Is NA
considered a scalar?
Default is TRUE
.
[logical(1)
]
Is NULL
considered a scalar?
Default is FALSE
.
[character(1)
]
Allows to restrict to specific type, e.g., “numeric”?
But instead of this argument you might want to consider using isScalar<Type>
.
Default is “atomic”, so no special restriction.