load {base}R Documentation

Reload Saved Datasets


Reload datasets written with the function save.


load(file, envir = parent.frame())


file a connection or a character string giving the name of the file to load.
envir the environment where the data should be loaded.


load can load R objects saved in the current or any earlier format. It can read a compressed file (see save) directly from a file or from a suitable connection (including a call to url).

Only R objects saved in the current format (used since R 1.4.0) can be read from a connection. If no input is available on a connection a warning will be given, but any input not in the current format will result in a error.


A character vector of the names of objects created, invisibly.


Saved R objects are binary files, even those saved with ascii = TRUE, so ensure that they are transferred without conversion of end of line markers. load tries to detect this case and give an informative error message.

See Also

save, download.file.


## save all data
save(list = ls(all=TRUE), file= "all.Rdata")

## restore the saved values to the current environment

## restore the saved values to the user's workspace
load("all.Rdata", .GlobalEnv)

## Not run: 
## print the value to see what objects were created.
## End(Not run)

[Package base version 2.1.0 Index]