Let's say you have a workspace of variables you would like to move to a different workspace. Maybe you have a pretrained model you would like to share. R provides a convient way to save and load data. In this article, we will see how to save and load objects in R.
To save object in R, we can use the save
function. We pass the function paramters of our variabels and the filename of where we want to store the data.
a = 2
b = "my string"
save(a, b, file="data.RData")
Then, we can move the file and reload it into our workspace with the load
function. We simply pass the filename to this function, assuming the file is in the new workspace.
load("data.RData")