How to use the save and load method In R Language
The save method in R writes an external representation of R objects to the specified file. These R objects can be retrieved back from the workspace using the load method.
Syntax:
save(objects, file)
Arguments :
- objects- The list of the objects to be saved
- file – the file name for the R objects to be saved and read from
Example: Saving and loading R data workspace
R
# creating data objects obj1 <- c (1:5) obj2 <- FALSE obj3 <- "w3wiki!!" # saving all data to the path save (obj1, obj3, file = "tempworkspaceobj.RData" ) load ( "tempworkspaceobj.RData" ) |
The RData objects are stored at the specified paths shown in the below snapshot.
Output:
Save and Load RData Workspace Files in R
In this article, we will discuss how to save and load R data workspace files in R programming language.