R/nz.R
nz.Rd
Returns all non-zero elements of a vector. Zeroness is determined by isZero(), i.e. within a numerical tolerance.
isZero()
nz(x, tol = sqrt(.Machine$double.eps))
a numeric vector.
tolerance passed to isZero().
a vector containing only the non-zero elements of x.
x
NA elements are not considered zero and are retained in the result.
NA
Other vector.utils: unwhich()
unwhich()
nz(c(0, 1, 2, 0, 3)) #> [1] 1 2 3 nz(c(1e-20, 1, NA)) #> [1] 1 NA