[R] Assigning functions in Rprofile

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Apr 21 09:09:20 CEST 2004


On Wed, 21 Apr 2004, Robert King wrote:

> I use the ugly hack shown below as my .Rprofile (mainly because I couldn't
> find any other way to spawn a new mozilla window on starting R or calling
> help.start(), but then send all the help html documents to that new
> window).
> 
> With a recent change from a cvs checkout to the released 1.9.0 I find that
> the new hs() appears if there is nothing of that name in .RData, but if
> there is the old hs() there, it just stays.
> 
> What is the cause of this?

?Startup tells you that .RData is loaded after .Rprofile is executed, but 
it has been that way for quite a while.  So this is behaving as 
documented, AFAICS.

What is new is that help.start() is now in package utils so you should be 
using utils::help.start() to be safe.

> 
> Thanks,
> Robert.
> 
> I'm using a debian i386 system.
> 
> .Rprofile
> =========
> library(gld)
> options(pager="less",CRAN="ftp://mirror.aarnet.edu.au/pub/cran")
> hs <- function(){
> if (nchar(system("echo $DISPLAY",intern=T))==0) # no X
>         {options(htmlhelp=FALSE)
>         ret <- "no X"}
> else    {system("mozilla") # we have X - I'm starting this to get a new
>         # window for the R session, without starting a new window every
> time
>         options(pdfviewer="/usr/local/bin/acroread",browser="mozilla")
>         help.start()
>         ret <- "X"}
> ret
> }

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list