uncompress.default {wavethresh} | R Documentation |
The compress
function compresses a sparse vector by
removing zeroes. This function performs the inverse transformation.
## Default S3 method: uncompress(x, verbose = getOption("verbose"), ...)
x |
The compressed or uncompressed object to
uncompress. |
verbose |
logical; if true then informative messages are printed. |
... |
further arguments to be passed to or from methods. |
See compress.default
to see what this function does to vectors.
The uncompress.default
function takes objects that have been output
from compress.default(.)
and restores them to their original values.
If the input to compress.default
was a sparse vector, then an object
of class compressed
would be returned. This class of object
(see compressed.object
) is a list containing the position
and values of all the non-zero elements of the original vector. The
uncompress.default
function reconstitutes the original vector.
Sometimes compression is not worthwhile (i.e. the original vector is not
sparse enough). In this case compress.default()
returns the original
vector in a list with class uncompressed
. The uncompress.default()
function's task in this case is simple: only return the vector part of
uncompressed
.
The uncompressed vector.
## Compress a sparse vector and look at it str(cv <- compress( vv <- c(rep(0,100),564) )) ## Uncompress the vector, (uncompress.default is used) str(ucv <- uncompress(cv)) all(ucv == vv) ## a bit less sparse: vv[sample(seq(vv), 5)] <- 1:5 str(cv <- compress(vv)) all(vv == uncompress(cv))