[R] "R": Redefine default parameter values for help.start()

paul paul.domaskis at gmail.com
Fri Apr 17 16:54:16 CEST 2015


Martin Maechler <maechler <at> lynne.stat.math.ethz.ch> writes:
> >>>>> paul  <paul.domaskis <at> gmail.com>
> >>>>>     on Thu, 16 Apr 2015 18:58:12 +0000 writes:
>
>     > Because of the setup of R in cygwin, help.start() requires
>     > the following parameter values:
>
>     > help.start(browser="cygstart",remote=R.home())
>
>     > Is it possible to make these values the default?
>
> You are building R from the sources, right?

No.  I haven't compiled code in a decade, but maybe I should get
back into that.  It won't happen soon, though -- the situation is
that the current cygwin install can't be changed, so installing isn't
an option, at least in the immediate term.  Also, expectations in
terms of time is such that getting a Windows based R would be
preferrable over compiling from scratch, though I must admit that
the latter won't happen any time soon either.

> Then, of course it is easily possible: Just modify your version
> of the R source code appropriately:
>
> It is file  <R>/src/library/utils/R/help.start.R
>
> (And you need more changes anyway to make things work under Cygwin;
>  but don't ask me about it: I do run R on Windows only very rarely)

OK, so now I'm not sure I follow.  By source, I normally think C.  But
the file extension above is *.R.  So I tried to take a look at the
file to see what kind of source it is. I can only descend down to
/usr/lib/R/library/utils/R/utils because
/usr/lib/R/library/utils/R/utils is not a directory.  It is a file:

   #  File share/R/nspackloader.R
   #  Part of the R package, http://www.R-project.org
   #
   #  Copyright (C) 1995-2012 The R Core Team
   #
   #  This program is free software; you can redistribute it and/or modify
   #  it under the terms of the GNU General Public License as published by
   #  the Free Software Foundation; either version 2 of the License, or
   #  (at your option) any later version.
   #
   #  This program is distributed in the hope that it will be useful,
   #  but WITHOUT ANY WARRANTY; without even the implied warranty of
   #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   #  GNU General Public License for more details.
   #
   #  A copy of the GNU General Public License is available at
   #  http://www.r-project.org/Licenses/

   local({
       info <- loadingNamespaceInfo()
       pkg <- info$pkgname
       ns <- .getNamespace(as.name(pkg))
       if (is.null(ns))
           stop("cannot find namespace environment for ", pkg, domain = NA);
       dbbase <- file.path(info$libname, pkg, "R", pkg)
       lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.")
   })

I know that I have a lot to learn about R.

Anyway, for now, I am getting around the problem via the following
~/.Rprofile:

   options(papersize="letter")
   options(browser="cygstart")
   options(help_type="html")
   helpstart <- function(){help.start(browser="cygstart",remote=R.home())}
   require(astsa)

>     > I do not want cygstart to be the browser except as a
>     > parameter for help.start().



More information about the R-help mailing list