A single-line function
that tests whether all elements are zero
(approximately).
is.allzero(x)
A logical
.
An object
whose elements are to be tested.
Chris Brien
The mean of the absolute values of the elements of x
is tested to determine if it is less than daeTolerance
, which is initially set to .Machine$double.eps ^ 0.5
(about 1.5E-08). The function set.daeTolerance
can be used to change daeTolerance
.
## create a vector of 9 zeroes and a one
y <- c(rep(0,9), 1)
## check that vector is only zeroes is FALSE
is.allzero(y)
Run the code above in your browser using DataLab