compress: In-memory zlib compression of R content

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/compress.R

Description

This uses the standard zlib algorithm/format for compressing the input into a buffer that can be passed to other computations.

This does not use the same algorithm or format that the shell tool compress uses, i.e. LZW (Lempel-Ziv-Welch).

Usage

1
compress(str, size = nchar(str) * 1.01 + 13, level = integer(3))

Arguments

str

the text to be compressed

size

the size for a working buffer that zlib uses during the compression.

level

the level of compression. This is a number between 0 and 9. 9 means highly compressed, 0 means no compression at all. The trade-off is computational intensity: the greater the compression, the greater the time spent performing the compression.

Value

A “raw” vector containing the compressed contents.

Author(s)

Duncan Temple Lang

References

zlib and bzip2

See Also

uncompress gunzip bunzip2

Examples

1
2
3
 x = "A string to compress"
 g = compress(x)
 uncompress(g) == x

statwonk/Rcompression documentation built on May 30, 2019, 10:43 a.m.