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

From: <timhesterberg_at_gmail.com>
Date: Sat, 23 Aug 2008 00:45:08 +0200 (CEST)


If save() fails because an object is not found, it should not overwrite an existing file.

> a <- 1:9
> save(a, file = "a.rda")
> rm(a)
> load("a.rda")
> a

 [1] 1 2 3 4 5 6 7 8 9
> rm(a)
> save(a, file = "a.rda")

Error in save(a, file = "a.rda") : object 'a' not found
> load("a.rda")

Error in load("a.rda") : error reading from connection

I've been saving copies of huge objects into files like a.rda, then removing the objects. If I then happen to save again, I don't want to lose my data.

--please do not edit the information below--

Version:
 platform = i486-pc-linux-gnu
 arch = i486
 os = linux-gnu
 system = i486, linux-gnu
 status =
 major = 2
 minor = 7.1
 year = 2008
 month = 06
 day = 23

 svn rev = 45970
 language = R
 version.string = R version 2.7.1 (2008-06-23)

Locale:
LC_CTYPE=en_US;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=en_US;LC_PAPER=en_US;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US;LC_IDENTIFICATION=C

Search Path:
 .GlobalEnv, package:Rfixes, package:Rcode, package:aggregate, package:stats, package:graphics, package:grDevices, package:utils, package:datasets, package:showStructure, package:splus2R, package:methods, Autoloads, package:base

        [[alternative HTML version deleted]]



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri 22 Aug 2008 - 22:52:03 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 23 Aug 2008 - 06:37:16 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive