Skip to content

Checking of integers #168

@PeterJacko

Description

@PeterJacko

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")
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions