Skip to content
Prev 29808 / 63424 Next

save() should not overwrite a file if an error occurs (PR#12583)

I don't know what save() "should" do - your use case is quite special
- but I agree it would be better if save() tests for the existence of
all object(s) to be saved before opening the connection (and thereby
overwrite the existing file).  A workaround for you is to do:

dummy <- a;
save(a, file="a.rda");

This should give an error before save() is called.

FYI, saveObject() of R.utils does protect you this way too, e.g.
[1] 1 2 3 4 5 6 7 8 9
Error in saveObject(a, file = "a.rda") : object "a" not found
[1] 1 2 3 4 5 6 7 8 9

/Henrik
On Fri, Aug 22, 2008 at 3:45 PM, <timhesterberg at gmail.com> wrote: