[R] customizing help()

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Tue Apr 4 14:34:56 CEST 2000


Prof Brian D Ripley <ripley at stats.ox.ac.uk> writes:

> Perhaps that was a bit mean, and the general principle at least may be
> illuminating.  The following should work:
> 
> my.help <- function(...)
> {
>     oc <- match.call()
>     oc[[1]] <- as.name("help")
>     oc$package <- quote(.packages(all = T))
>     oc$lib.loc <- quote(.lib.loc)
>     oc$chmhelp <- TRUE
>     eval.parent(oc)
> }

Or, if all you want to do is to be able to modify the topic:

my.help <- function(topic){
	oc <- substitute(help(topic,package=.packages(all = T),
	              lib.loc=.lib.loc, chmhelp=TRUE))
	eval.parent(oc)
}

Or, probably best:

my.help <- function(topic, package=.packages(all = T),
	              lib.loc=.lib.loc, chmhelp=TRUE) {
	oc <- match.call()
	oc[[1]] <- as.name("help")
	eval.parent(oc)
}

(The latter variant is the only one where you can override the
defaults for the package, lib.loc, and chmhelp=TRUE)

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list