On 07.02.2013 19:21, James Jong wrote:> I have an environment variable `$R_HISTFILE` pointing to
> `/home/my.username/.RHistory` and the following code in my `.Rprofile` in
> my home directory:
>
>
> .Last <- function() {
> if (!any(commandArgs()=='--no-readline') &&
interactive()){
> require(utils)
> try(savehistory(Sys.getenv("R_HISTFILE")))
> }
> }
>
> Still whenever I open R, and I type `history()` I can't see the
commands
> that I typed in earlier sessions. Moreover, the files `.RHistory` is pretty
> much empty with only three lines, (not at all reflecting commands I typed
> in the past).
>
> How can I automatically save my history of commands and easily re-use them
> across R sessions?
Works for me with a recent R in Windows.
Are you sure R_HISTFILE is set properly, the directory exists, you have
write access etc?
Do you actually load that file on startup? Note that ".Rhistory" is
read
in the current directory (rather than ".RHistory" in your home dir).
See
?Startup
Best,
Uwe Ligges
>
> James
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>