[R] categorized complete list of R commands?

Duncan Murdoch murdoch.duncan at gmail.com
Fri Apr 5 14:24:32 CEST 2013

On 13-04-05 12:46 AM, ivo welch wrote:
> hi michael: now give my code and your middle rewrites code to an R novice
> and ask them to guess what it does.  ;-).
> my personal rule, for the most part, is to go with the clever idiomatic way
> when performance or space matter AND, and to go for the simple idiotic way
> when I want to understand in a few years what I wrote a while back or when
> it requires mental effort, thinking, or research into how to structure it.
>   frankly, as I get older, my memory gets worse and worse, possibly because
> I have too many other things to take care of at the same time in my day
> job.  for my R code, KISS---and I count myself among the S's.
> there are of course exceptions to the rule, principally when the idiomatic
> way is easier to understand in future years, often when the idiomatic way
> is shorter.  your final version clearly qualifies in being elegant and easy
> to reread in years to come.  your final version was based on stuff I
> learned from reading r-help over the years, so I could have eventually
> figured it out.  so, the elegance is appreciated and not lost on me.  I did
> not care too much for the middle rewrites.
> more relevantly, I wonder whether I should just write a "find" script in
> perl and self-parse the .Rd files that are strewn around my hard drive, or
> whether there is an idiomatic R way...

These things aren't normally relevant to users so the documentation may 
be hard to find, but R does supply a parser for Rd files 
(tools::parse_Rd), and installed packages have the Rd files stored in 
parsed form.

You can look at the various processors (Rd2HTML, etc.) for more hints 
than the documentation (linked on the parse_Rd help page) gives.

To see the current way that R finds the parsed form of a help file, look 
through how an object like "?mean" gets printed.  I recommend you look 
at the printing in text format.  This mechanism is undocumented because 
it may change, so you're probably better off using the parse_Rd route 
for routine things, but for a one-off calculation, it may be faster to 
use the parsed objects.

Duncan Murdoch

More information about the R-help mailing list