.Rdata (also known as
.rda) files can be used to store R objects in a format native to R. There are multiple advantages of saving this way when contrasted with non-native storage approaches, e.g.
readRDS only handle a single R object. However, they are more flexible than the multi-object storage approach in that the object name of the restored object need not be the same as the object name when the object was stored.
Using an .rds file, for example, saving the
iris dataset we would use:
saveRDS(object = iris, file = "my_data_frame.rds")
To load it data back in:
iris2 <- readRDS(file = "my_data_frame.rds")
To save a multiple objects we can use
save() and output as
Example, to save 2 dataframes: iris and cars
save(iris, cars, file = "myIrisAndCarsData.Rdata")