[Rd] RFC: What should ?foo do?

Duncan Murdoch murdoch at stats.uwo.ca
Fri Apr 25 16:44:53 CEST 2008

On 4/25/2008 10:16 AM, Robert Gentleman wrote:
> Duncan Murdoch wrote:
>> Currently ?foo does help("foo"), which looks for a man page with alias 
>> foo.  If foo happens to be a function call, it will do a bit more, so
>> ?mean(something)
>> will find the mean method for something if mean happens to be an S4 
>> generic.  There are also the type?foo variations, e.g. methods?foo, or 
>> package?foo.
>> I think these are all too limited.
>> The easiest search should be the most permissive.  Users should need to 
>> do extra work to limit their search to man pages, with exact matches, as 
>> ? does.
>    While I like the idea, I don't really agree with the sentiment above. 
> I think that the easiest search should be the one that you want the 
> result of most often.
> And at least for me that is the man page for the function, so I can 
> check some detail; and it works pretty well.  I use site searches much 
> less frequently and would be happy to type more for them.

That's true.

What's your feeling about what should happen when ?foo fails?

>> We don't currently have a general purpose search for "foo", or something 
>> like it.  We come close with RSiteSearch, and so possibly ?foo should 
>> mean RSiteSearch("foo"), but
>> there are problems with that: it can't limit itself to the current 
>> version of R, and it doesn't work when you're offline (or when 
>> search.r-project.org is down.)  We also have help.search("foo"), but it 
>> is too limited. I'd like to have a local search that looks through the 
>> man pages, manuals, FAQs, vignettes, DESCRIPTION files, etc., specific 
>> to the current R installation, and I think ? should be attached to that 
>> search.
>   I think that would be very useful (although there will be some 
> decisions on which tool to use to achieve this). But, it will also be 
> problematic, as one will get tons of hits for some things, and then 
> selecting the one you really want will be a pain.
>   I would rather see that be one of the dyadic forms, say
>    site?foo
>   or
>    all?foo
>   one could even imagine refining that for different subsets of the docs 
> you have mentioned;
>    help?foo #only man pages
>    guides?foo #the manuals, R Extensions etc
> and so on.
>    You did not, make a suggestion as to how we would get the equivalent 
> of ?foo now, if a decision to move were taken.

I didn't say, but I would assume there would be a way to do it, and it 
shouldn't be hard to invoke.  Maybe help?foo as you suggested, or man?foo.

Duncan Murdoch

More information about the R-devel mailing list