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

Save

Faciliate Use of save and load to Remote Directories


Description

These functions are slightly enhanced versions of save and load that allow a target directory to be specified using options(LoadPath="pathname"). If the LoadPath option is not set, the current working directory is used.

Usage

# options(LoadPath='mypath')
Save(object, name=deparse(substitute(object)), compress=TRUE)
Load(object)

Arguments

object

the name of an object, usually a data frame. It must not be quoted.

name

an optional name to assign to the object and file name prefix, if the argument name is not used

compress

see save. Default is TRUE which corresponds to gzip.

Details

Save creates a temporary version of the object under the name given by the user, so that save will internalize this name. Then subsequent Load or load will cause an object of the original name to be created in the global environment. The name of the R data file is assumed to be the name of the object (or the value of name) appended with ".rda".

Author(s)

Frank Harrell

See Also

Examples

## Not run: 
d <- data.frame(x=1:3, y=11:13)
options(LoadPath='../data/rda')
Save(d)   # creates ../data/rda/d.rda
Load(d)   # reads   ../data/rda/d.rda
Save(d, 'D')   # creates object D and saves it in .../D.rda

## End(Not run)

Hmisc

Harrell Miscellaneous

v4.5-0
GPL (>= 2)
Authors
Frank E Harrell Jr <fh@fharrell.com>, with contributions from Charles Dupont and many others.
Initial release
2021-02-27

We don't support your browser anymore

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