Re: [Rd] a hack regarding "No documentation ...."

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Sun 26 Jun 2005 - 21:15:37 GMT

On 6/26/05, Mike R <mike.rstat@gmail.com> wrote:
> > ?somecharacters
> No documentation for 'somecharacters' in specified packages and libraries:
> you could try 'help.search("somecharacters")'
> >
>
> I'm looking for some advice. I'd like to hack my source code
> in such a way that the empty prompt line above is "pre-filled"
> with the suggested command. In effect, this would make it
> unnecessary to copy-paste (or type)
> help.search("somecharacters")
>
> If I did not want to execute the suggested command, I would
> Ctrl-c the pre-filled line.
>
> Alternatively, the hack could implement a query, as in:
>
> > ?somecharacters
> No documentation for 'somecharacters' in specified packages and libraries:
> you could try:
> 0 - help.search("somecharacters")
> 1 - RSiteSearch("somecharacters")
> 2 - apropos(somecharacters)
> 3 - etc .....
> <enter> - no action
>
> .... in which case, typing 0, 1, 2, 3, ... and <enter> would issue
> the corresponding command, or would pre-fill a command line
> with the corresponding command (which could then be edited).
>
> Alternatively, the hack could add the recommended commands to
> the command history, in which case I could use the up/down
> arrows to navigate to them.
>
> I suppose it might be the case that a similar feature is already
> part of R, and that I am just not aware of it. As a newbie, I spend
> most of my time searching/reading documentation.
>
> Any comments regarding the possible alternatives that I've
> mentioned, or offers of your own alternatives, would be
> appreciated, as would be suggestions or mini-outlines for
> implementing the hack.
>

Redefine ?, e.g.

"?" <- function(e1) cat("You entered", substitute(e1), "\n") ?abc

To see the definition of ? that comes with R:   rm("?") # remove definition we just made above   get("?") # look at the definition of function ?



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon Jun 27 07:17:46 2005

This archive was generated by hypermail 2.1.8 : Mon 24 Oct 2005 - 22:27:22 GMT