[R] PowerCut Killed R - is my code retrievable?
b.rowlingson at lancaster.ac.uk
Thu Aug 20 00:35:01 CEST 2009
On Wed, Aug 19, 2009 at 10:57 PM, Polwart Calum (County Durham and
Darlington NHS Foundation Trust)<calum.polwart at nhs.net> wrote:
> I've been tweaking code for several days on and off in R, cut and pasting in from a text editor (I just leave them open all the time). I think I got something that was usable but then a powersurge tripped the fuses and unfortunately the machine I was working on doesn't have a UPS.
So you were just using the text editor as a scratch pad, and not
saving it? A half-decent text editor should be saving things to disk
as you go. For example, in emacs, if your emacs dies while editing a
file then when you restart it, it will notice and offer to restore it
from its "restore" file. If you were using emacs you might have files
like #foo.R# which are emacs' auto-restore files. Other editors might
do other things - possibly leaving files in /tmp on a Linux system
(but they might get zapped by a reboot).
> Also - is there a better way for the future? I know some people use IDE's but is that for serious programming or for building a small function and tweaking it?
Tip #1 is save your text file scratchpads!
Tip #2 is save your R session regularly (just do 'save.image()' and
it will save your current R session objects in a .RData file)
Tip #3 is you could use emacs + ESS as an IDE - you run R within
emacs, giving you cut n paste of code, syntax highlighting, session
transcripts, and emacs' protection from data loss on a crash!
More information about the R-help