https://www.r-bloggers.com/how-to-save-and-load-datasets-in-r-an-overview/
Save R objects
- save() -> create an .Rdata file, where several variables can be stored. To save space, use with compress=TRUE (default), to save time use with compress = FALSE.
data2 <- data
save(list = c("data", "data2"), file = "data.Rdata")
load("data.Rdata")
- saveRDS() -> create an .Rds file. where only 1 variable can be stored. The compress parameter is also available for saveRDS)
saveRDS(data, file = "data.Rds")
data.copy <- readRDS(file = "data.Rds")
With readRDS(), assign the result of the reading process to a variable.
With load(), you have to remember the name of the stored variable.
Save as a CSV file
-
write.table()
-
fwrite()
Save as an Excel file
library(WriteXLS)
WriteXLS()