Learn R Programming

readr (version 0.2.2)

write_rds: Write a single R object to file

Description

Consistent wrapper around saveRDS. write_rds does not compress by default as space is generally cheaper than time.

Usage

write_rds(x, path, compress = c("none", "gz", "bz2", "xz"), ...)

Arguments

x
R object to write to serialise.
path
Path to write to.
compress
Compression method to use: "none", "gz" ,"bz", or "xz".
...
Additional arguments to connection function. For example, control the space-time trade-off of different compression methods with compression. See connections for more details.

Value

The input x, invisibly.

Examples

Run this code
## Not run: 
# write_rds(mtcars, "mtcars.rds")
# write_rds(mtcars, "compressed_mtc.rds", "xz", compression = 9L)
# ## End(Not run)

Run the code above in your browser using DataLab