In the bash shell we can use PROMPT_COMMAND="history -a" to tell bash to
always append the last command to the history file. It will do this with
every command so that if bash crashes or an ssh connection is lost, the
command history will still be available in the history file.
With R, I see there is a savehistory() command (link below), but I have
some questions:
(1) does savehistory() append to the current history file or overwrite it?
(2) if it appends, when savehistory() is evoked repeatedly, does it only
append commands that haven't already been appended? Or does it append the
entire history to the file?
(3) Is there a way to evoke history saving automatically so that the file
is always updated?
I have the impression that savehistory() only overwrites and cannot
append. If that's true, I might still get what I want, but I'd be doing a
lot of unnecessary writing. Luckily, my R history is usually quite short.
So if I were to enter 100 commands, appending would write 100 lines, but
overwriting would write 5050 lines.
savehistory:
http://stat.ethz.ch/R-manual/R-devel/library/utils/html/savehistory.html
Best,
Mike
--
Michael B. Miller, Ph.D.
Minnesota Center for Twin and Family Research
Department of Psychology
University of Minnesota
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.