savehistory directories and quitting R (PR#2038)

Duncan Murdoch dmurdoch@pair.com
Thu, 19 Sep 2002 21:22:43 -0400


On Fri, 20 Sep 2002 10:20:37 +1000, you wrote:

>Thanks Duncan--
>
>Intriguingly, this works if I set R_HISTFILE before starting R (via
>.Renviron), but not if I do this within R:
>
>> Sys.putenv( 'R_HISTFILE'='D:/TEMP/.Rhistory')
>> q()
>
>
>Is that a bug? It could potentially cause problems if you change your mind
>within a session about where history is to be saved. I have flirted with
>doing this (because I switch projects within a session) but have decided not
>to, for now.

The internal variable that holds the value is set at startup.  I don't
think this is a bug, because I don't know of any documentation that
suggests it would do anything else, but it probably would make sense
to read the environment at the time the save is requested, rather than
at startup.

>BTW I can see why namespaces are almost essential if people are writing lots
>of packages. But what if I actually WANT to fiddle about with system
>behaviour? In the case of savehistory, I actually change the copy in "base"
>as part of my .First, rather than creating a masking copy (can't remember
>why I decided to do this, but still). Will I still be able to do this sort
>of thing if I need to?

I'm no expert on namespaces, but I think you can, similar to the way
that you now save things into specific environments rather than the
global one.

Duncan Murdoch
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._