zapsmall: Rounding of Numbers

Description Usage Arguments References Examples

View source: R/zapsmall.R

Description

zapsmall determines a digits argument dr for calling round(x, digits = dr) such that values close to zero (compared with the maximal absolute value) are ‘zapped’, i.e., treated as 0.

Usage

1
zapsmall(x, digits = getOption("digits"))

Arguments

x

a numeric or complex vector.

digits

integer indicating the precision to be used.

References

Chambers, J. M. (1998) Programming with Data. A Guide to the S Language. Springer.

Examples

1
2
3
4
5
x2 <- pi * 100^(-1:3)
print(x2 / 1000, digits = 4)
zapsmall(x2 / 1000, digits = 4)

zapsmall(exp(1i*0:4*pi/2))

robertzk/monadicbase documentation built on May 27, 2019, 10:35 a.m.