Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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(file)

write_rds(
  x,
  file,
  compress = c("none", "gz", "bz2", "xz"),
  version = 2,
  path = deprecated(),
  ...
)

Arguments

file

The file path to read from/write to.

x

R object to write to serialise.

compress

Compression method to use: "none", "gz" ,"bz", or "xz".

version

Serialization format version to be used. The default value is 2 as it's compatible for R versions prior to 3.5.0. See base::saveRDS() for more details.

path

[Deprecated]

...

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

temp <- tempfile()
write_rds(mtcars, temp)
read_rds(temp)

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

## End(Not run)

readr

Read Rectangular Text Data

v1.4.0
GPL (>= 2) | file LICENSE
Authors
Hadley Wickham [aut], Jim Hester [aut, cre], Romain Francois [ctb], R Core Team [ctb] (Date time code adapted from R), RStudio [cph, fnd], Jukka Jylänki [ctb, cph] (grisu3 implementation), Mikkel Jørgensen [ctb, cph] (grisu3 implementation)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.