This will return FALSE for NULL and vectors of length bigger than 2.
is.scalar(x)
x
Object to be checked.
TRUE if the object is a scalar, FALSE otherwise.
TRUE
FALSE