Skip to content
Prev 21121 / 63424 Next

Function hints

I've moved this from R-help to R-devel, where I think it is more 
appropriate, and interspersed comments below.
On 6/19/2006 8:51 AM, hadley wickham wrote:
I think it's bad to document dissimilar functions in the same file, but 
similar related functions *should* be documented together.  Not doing 
this just adds to the burden of documenting them, and the risk of 
modifying only part of the documentation so that it is inconsistent. 
The user also gets the benefit of seeing a common description all at 
once, rather than having to decide whether to follow "See also" links.

Your solutions would both be interesting on their own merits regardless 
of the above.  We did decide to work on preprocessing directives for .Rd 
files at the R core meetings; some sort of include directive may be 
possible.

I don't think I would want complete documentation mixed with the 
original source, but it would certainly be interesting to have partial 
documentation there.  (Complete documentation is too long, and would 
make it harder to read the source without a dedicated editor that could 
hide it.  Though ESS users may see it as a reasonable requirement to 
have everyone use the same editor, I don't think it is.)  However, this 
is a lot of work, depending on infrastructure that is not in place.
I think it is worse than that.  There are concepts in packages that just 
don't arise in base R, and hence there would be no keywords for them 
other than "misc", even if someone redesigned the current system. 
Keywording is hard, and it's not clear to me how to do much better than 
we currently do.

We do already have user-defined keywords (via \concept), but these are 
not widely used.
I'd say it's a deficiency of your function.  You might want to look at 
the code in get("?") and .helpForCall() to see how those functions work 
out things like

?simulate(x)

where x is an lm object.  (But notice that .helpForCall is an 
undocumented internal function; don't depend on its implementation 
working forever).
No, not if the call syntax above is used.

  I do the best I can
I think strwrap() may do what you want.
It's quite hard to go from existing title case to sentence case, because 
we don't have any markup to indicate proper names.  One would think it 
would be easier to go in the opposite direction, but in fact the same 
problem arises:  "van Beethoven" for example, not "Van Beethoven".
I don't like the name "hints".  I think we already have too many ways 
into the help system:

help
?
help.search
apropos
etc.?

I like your function, but I'd rather see it attached to one of the 
existing help functions, probably help.search().  For example,

help.search(x)

could look for functions designed to work with the class of x, if it had 
one.  (There's some ambiguity here:  perhaps x contains a string, and I 
want help on that string.)

Anyway, thanks for your efforts on this so far; I hope we end up with 
something that can make it into the next release.

Duncan Murdoch