is_positive_integer | R Documentation |
A positive integer is a whole number that is greater than 0.
is_positive_integer(x)
x |
A vector |
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'.
TRUE if all elements are positive integers (NA ignored)
is_positive_integer(c(1L, 2L, 4L)) # TRUE
is_positive_integer(2.4) # FALSE
is_positive_integer(-3) # FALSE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.