1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cutree.dendrogram.R
\name{is.natural.number}
\alias{is.natural.number}
\title{Check if numbers are natural}
\source{
This function was written by marcog, as an answer to my question here:
\url{https://stackoverflow.com/questions/4562257/what-is-the-fastest-way-to-check-if-a-number-is-a-positive-natural-number-in-r}
}
\usage{
is.natural.number(x, tol = .Machine$double.eps^0.5, ...)
}
\arguments{
\item{x}{a vector of numbers}
\item{tol}{tolerence to floating point issues.}
\item{...}{(not currently in use)}
}
\value{
logical - is the entered number natural or not.
}
\description{
Vectorized function for checking if numbers are natural or not.
Helps in checking if a vector is of type "order".
}
\examples{
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))
}
\seealso{
\code{\link{is.numeric}}, \code{\link{is.double}}, \code{\link{is.integer}}
}
\author{
Marco Gallotta (a.k.a: marcog), Tal Galili
}
|