is_positive_integer {schematic} | R Documentation |
Check if a vector has all positive integers
Description
A positive integer is a whole number that is greater than 0.
Usage
is_positive_integer(x)
Arguments
x |
A vector |
Details
This check requires 'is.integer(x)' to be true. If you want a more flexible check that allows for numbers of type 'numeric' but still want them to be integers, then use 'is_whole_number()'.
'NA's are ignored as long as they are 'NA_integer'.
Value
TRUE if all elements are positive integers (NA ignored)
Examples
is_positive_integer(c(1L, 2L, 4L)) # TRUE
is_positive_integer(2.4) # FALSE
is_positive_integer(-3) # FALSE
[Package schematic version 0.1.2 Index]