Saving and loading objects¶
# In this example we create the two variables 'a' and 'b':
a <- 1
b <- 1
# We save them in the data file "ab.RData"
save(a,b,file="ab.RData")
# We then remove the two variables:
rm(a,b)
ls()
character(0)
# With then load the data file
load("ab.RData")
# and verify that the two variables are restored
ls()
[1] "a" "b"
a
[1] 1
b
[1] 1
- R file: saving-and-loading-objects.R
- Rmarkdown file: saving-and-loading-objects.Rmd
- Jupyter notebook file: saving-and-loading-objects.ipynb
- Interactive version of the Jupyter notebook (shuts down after 60s):
- Interactive version of the Jupyter notebook (sign in required):