ID EN
Miscellaneous

zapsmall

R Base 3.6.2

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., replaced by 0.

Syntax

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

Arguments

Parameter Description
x a numeric or complex vector or any R number-like object which has a round method and basic arithmetic methods including log10().
digits integer indicating the precision to be used.

Examples

Example
R
# NOT RUN {
x2 <- pi * 100^(-1:3)
print(x2 / 1000, digits = 4)
zapsmall(x2 / 1000, digits = 4)

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