The question a bit self explanatory but I should add that I do not want to load the file. I'm looking for something like append = TRUE
for saving a .RData
file . I want to do something like this:
save(df, file="mtcars.Rda",append = TRUE)
Here is a reproducible example:
# load data
data("mtcars")
head(mtcars)
# save original DF
save(mtcars, file="mtcars.Rdata")
# create another DF
df <- mtcars
# append DF to a saved Rdata file
save(df, file="mtcars.Rdata",append = TRUE)
Error in save(df, file = "mtcars.Rdata", append = TRUE) : object ‘TRUE’ not found
AFAIK, You'll have to
load
file to make changes in saved objects and then save those objects again. You can't even view names of objects stored without loading, let alone modifying contents.If you want a one-line solution, you can write a function.
SOmething like this may help for adding new objects to an existing .Rdata file: