[Rd] Shortcuts for help functions
Yan Wong
h.y.wong at leeds.ac.uk
Tue Aug 15 14:20:20 CEST 2006
Hi,
This is a short suggestion for an improvement to R that I can code up
if it is deemed sensible.
While learning to use R, I found myself using help.search
extensively, and would have made use of RSiteSearch had I realised
that it was available.
I suggest that "shortcuts" to these functions could be coded, with
increasing numbers of question marks corresponding to increasing
desperation on the part of the user, so that
?topic --- invokes help("topic") (as currently)
??topic --- invokes help.search("topic")
???topic --- invokes RSiteSearch("topic", restrict = c("functions",
"docs"))
#don't search in the mailing lists - they can be
confusing to a beginner
????topic --- invokes RSiteSearch("topic", )
#search very widely
It may be that my distinction between ??? and ???? is too fine, and
it would be preferable just to have a single invocation of RSiteSearch.
I have actually coded this up: it requires minor modification of src/
main/gram.y to recognise "??", "???", and "????" as valid unary
operators, then addition of code such as the following to src/library/
utils/R/question.R
### Example of help.search shortcut.
"??" <- function(e1)
{
e1Expr <- substitute(e1)
e1 <- as.character(e1Expr)
eval(substitute(help.search(PATTERN), list(PATTERN = e1)))
}
#### End
Does this seem like a sensible idea? If so, in what form should I
send the patches? I had a quick scan of the R-devel pages but
couldn't easily see what the preferred method for patch submission was.
Thanks
Yan
--
H. Y. Wong
University of Leeds
More information about the R-devel
mailing list