Learn R Programming

readr (version 1.1.1)

read_rds: Read/write RDS files.

Description

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

Usage

read_rds(path)

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

Arguments

path

Path to read from/write to.

x

R object to write to serialise.

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

write_rds() returns x, invisibly.

Examples

Run this code
# NOT RUN {
temp <- tempfile()
write_rds(mtcars, temp)
read_rds(temp)

# }
# NOT RUN {
write_rds(mtcars, "compressed_mtc.rds", "xz", compression = 9L)
# }

Run the code above in your browser using DataLab