Description Usage Arguments Value Note See Also Examples
In-memory compression or decompression for raw vectors, cf.
memCompress
.
1 2 3 | lzCompress(from, level = 0L, type)
lzDecompress(from, type)
|
from |
A raw or character vector to be compressed (for |
level |
An integer between 0 (fast but less compression) and 9 (slow but more compression), inclusive. |
type |
Not used! This dummy argument is present to facilitate drop-in replacement with
|
A raw vector representing the compressed object.
The functions are compatible with the command-line lz4 format for easy interoparability with other applications. See the examples.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | x <- head(airquality)
y <- lzCompress(serialize(x, NULL))
z <- unserialize(lzDecompress(y))
all.equal(x, z)
## Not run:
# Compatibility with the lz4 file format, this example assumes that
# the 'lz4' program is in your system PATH.
# Compress some text in R and save to a file:
compressed_file <- tempfile()
writeBin(lzCompress(capture.output(head(state.x77))), compressed_file)
# Now decompress those data with command-line lz, saving to another file:
decompressed_file <- tempfile()
system2("lz4", args=c("-d", compressed_file, decompressed_file))
# Examine the output:
readLines(decompressed_file, warn=FALSE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.