3.2 Loading variable data
To load in an Rdata (binary) object back into your workspace use the load()
function. You will need to provide the path to the filename.
load("chocolate.Rdata")
exists('mandm')
## [1] TRUE
class(mandm)
## [1] "character"
dim(mandm)
## NULL
frequency <- table(mandm)
In the following example, we are saving multiple variables to one file:
save(mandm,frequency,file = "chocolate.Rdata")
Saving and loading
Enter the code blocks above for saving and loading data. Remember to remove the variable after saving it so that you can test the variable has been loaded properly.
Try the following chucnk of code after saving multiple variables:
rm(mandm, frequency)
frequency
load("chocolate.Rdata")
frequency