Closed brichard1638 closed 1 year ago
From the software engineering best practice perspective, I think it's generally recommended to use functions like save()
, saveRDS()
for saving (serializing) individual objects, or explicitly save the data needed in a suitable file format, instead of using save.image()
to save everything. Specific reasons might include:
When working in the R environment, data is created, collected, and used in the form of various list objects, vectors, models, and datasets. By applying the save.image function found in Base R, the entire active workspace can be saved to a single data file. The R file extension used must be .RData. In RStudio, data objects are extracted and subsequently converted into an .RData file from the Environment tab.
save.image(file = "my_work_space.RData")
To load the entire workspace back into an RStudio active session, apply the following code:
load("my_work_space.RData")
NOTE: If no formal file path is provided in the file argument, the file will be saved in the user's Documents folder.