clean_int: Clean integer input

View source: R/clean.R

clean_intR Documentation

Clean integer input

Description

Clean integer input

Usage

clean_int(x, xname = deparse(substitute(x)))

Arguments

x

Double or integer vector to check.

xname

Character: Name of the variable for error messages.

Details

The goal is to return an integer vector. If the input is integer, it is returned as is. If the input is numeric, it is coerced to integer only if the numeric values are integers, otherwise an error is thrown.

Value

Integer vector.

Author(s)

EDG

Examples

clean_int(6L)
clean_int(3)
# clean_int(12.1) # Error
clean_int(c(3, 5, 7))
# clean_int(c(3, 5, 7.01)) # Error

rtemis.core documentation built on April 22, 2026, 1:11 a.m.