View source: R/cutree.dendrogram.R
is.natural.number | R Documentation |
Vectorized function for checking if numbers are natural or not. Helps in checking if a vector is of type "order".
is.natural.number(x, tol = .Machine$double.eps^0.5, ...)
x |
a vector of numbers |
tol |
tolerence to floating point issues. |
... |
(not currently in use) |
logical - is the entered number natural or not.
Marco Gallotta (a.k.a: marcog), Tal Galili
This function was written by marcog, as an answer to my question here: https://stackoverflow.com/questions/4562257/what-is-the-fastest-way-to-check-if-a-number-is-a-positive-natural-number-in-r
is.numeric
, is.double
, is.integer
is.natural.number(1) # is TRUE
(x <- seq(-1, 5, by = 0.5))
is.natural.number(x)
# is.natural.number( "a" )
all(is.natural.number(x))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.