Currently, we use, e.g., the code below to check if input argument is integer. Can't we instead of expecting "double" type and relying on the equality of rounding, directly require "integer" type (users can use as.integer)?
[May apply to several functions]
# Throw error if vArrTimes is not a vector of integers
if (!(is.atomic(vArrTimes) && typeof(vArrTimes) == "double")) {
stop("Supplied vector is not scalar")
}
# Throw error if vArrTimes is not a vector of integers
if (!all(vArrTimes == round(vArrTimes))) {
stop("Supplied vector is not scalar")
}
Currently, we use, e.g., the code below to check if input argument is integer. Can't we instead of expecting "double" type and relying on the equality of rounding, directly require "integer" type (users can use as.integer)?
[May apply to several functions]