Often, data are computed in real (not integer) numbers, and in
such cases, comparison to zero is not as good as using a
tolerance level. Modifying slightly the suggestions of others, I
would use something like this:

my.tol <- 1e-50
x <- c(1.4, 2.97, 1.0e-100, pi, 0.2, 5.1, 6.8, 0.0)
print(x)
is.na(x) <- abs(x) < my.tol
print(x)


-- 
Mike Prager, NOAA, Beaufort, NC
* Opinions expressed are personal and not represented otherwise.
* Any use of tradenames does not constitute a NOAA endorsement.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to