compressed RDS | R Documentation |
Save and read RDS functions for using multithreaded “ZSTD” or “LZ4” compression
saveRDSfst(object, filename = "", compression = 100, algorithm = "ZSTD")
readRDSfst(filename)
object |
An R object to be saved. |
filename |
A character string giving the filename of the object on disk (to save to or read from) |
compression |
A numeric value between 0 and 100 indicating the amount of compression. Defaults to 100, the highest level of compression. 0 gives the lowest compression. |
algorithm |
A character string of the type of compression to use. Defaults to “ZSTD” which is better compression but slower. The only other option is “LZ4” which is faster but may provide less compression. |
By default, saveRDS()
does not have multithreaded compression
built in. These functions use “ZSTD” or “LZ4” compression
via the fst
package for multithreaded compression and decompression
with good performance.
To save them, objects are serialized, compressed, and then saved using saveRDS()
.
To read them, objects are read in using readRDS()
, decompressed, and then unserialized.
Hashing is used to verify the results. saveRDS()
is performed using version = 3
,
so it will not work on older versions of R
.
saveRDSfst()
is called for its side effect of saving a file to disk.
The original R
object if using readRDSfst()
.
saveRDSfst(mtcars, filename = file.path(tempdir(), "mtcars.RDS"))
saveRDSfst(mtcars, filename = file.path(tempdir(), "mtcars.RDS"))
readRDSfst(file.path(tempdir(), "mtcars.RDS"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.