Save an R object with a new name

Share:

Description

Saves an R object as name in an Rdata file called path/name.RData.

Usage

1
saveas(obj, name, path=".")

Arguments

obj

R object to save

name

character string with the new name for the R object

path

path for the Rdata file (saved file will be path/name.RData)

Details

The suffix ".RData" will be appended to the new object name to create the file name, and the file will be written to the path directory.

Author(s)

Stephanie Gogarten

See Also

getobj

Examples

1
2
3
4
5
6
x <- 1:10
path <- tempdir()
saveas(x, "myx", path)
newfile <- paste(path, "/myx", ".RData", sep="")
load(newfile) # myx now loaded
unlink(newfile)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.