Debian Codegraph @

man/is.natural.number.Rd

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