save_rds: Save Compressed *.rds File

View source: R/save.R

save_rdsR Documentation

Save Compressed *.rds File

Description

A thin wrapper around saveRDS() that ensures two things:

  • The path extension is consistent and lowercase *.rds

  • The compression used is "xz", which is often optimal for our data types

Usage

save_rds(object, file)

save_rda(..., file)

getCompression(file)

Arguments

object

R object to serialize.

file

a connection or the name of the file where the R object is saved to or read from.

...

the names of the objects to be saved (as symbols or character strings).

Value

Returns file, invisibly.

Functions

  • save_rda: similar to save_rds(), but for saving serialized *.rda compressed files.

  • getCompression: determine the type of compression for a serialized binary file.

Examples

## Not run: 
# all are the same
save_rds(x, "outfile.rds")
save_rds(x, "outfile.RDS")
save_rds(x, "outfile.Rds")

# similar functionality for rda
# as with `save()`, must specify file argument explicitly
save_rda(x, file = "outfile.rda")

# determine the compression ('xz')
getCompression("outfile.rda")

## End(Not run)

stufield/TestPkg documentation built on Jan. 26, 2023, 10:48 p.m.