zap {spray} | R Documentation |
Zap small values in a spray object
Description
Generic version of zapsmall()
Usage
zap(x, digits = getOption("digits"))
## S4 method for signature 'spray'
zapsmall(x, digits = getOption("digits"))
Arguments
x |
spray object |
digits |
number of digits to retain |
Details
Given a spray object, coefficients close to zero are ‘zapped’,
i.e., replaced by ‘0’, using base::zapsmall()
. Function
zap()
is an easily-typed alias; zapsmall()
is the
S4
generic.
Note, zap()
actually changes the numeric value, it is not just
a print method.
Author(s)
Robin K. S. Hankin
Examples
(S <- spray(matrix(sample(1:50),ncol=2),10^-(1:25)))
zap(S)
S-zap(S) # print method will probably print zeros...
coeffs(S-zap(S)) # ...but they are nevertheless nonzero
[Package spray version 1.0-25 Index]