[R] R Style Guide -- Was Post-hoc tests in MASS using glm.nb

Bert Gunter gunter.berton at gene.com
Thu May 19 16:08:13 CEST 2011


Thanks Martin,

Your points are, of course, well taken. Nevertheless, I still think it
might be useful to put a link or links to one or more style guides in
the FAQ with a comment to the effect that these are various
recommended ways to help write better, more readable code. Something
like:

------------------------------
Q: What are best practices for R coding style?

A: There is no simple answer to this question, as programming style is
legitimately a personal choice and may depend on the nature of the
programming task. However useful guidelines and alternatives can be
found at <links to one or more style guides>.

-------------------------------

One important point: The links need to be reasonably stable, and this
could be problematic.

However, I am happy to defer to R Core and experienced R programmers
like yourself on these matters.

Cheers to all,
Bert

On Thu, May 19, 2011 at 3:26 AM, Martin Maechler
<maechler at stat.math.ethz.ch> wrote:
>
>    BertG> Thanks Bill. Do you and others think that a link to
>    BertG> this guide (or another)should be included in the
>    BertG> Posting Guide and/or R FAQ?
>
> Hmm, that guide is Google's work, and is probably quite good if
> you have a group of R programmers in the same company,
> but e.g., has not been published in collaboration with the R core team,
> and actually somewhat differs from our own .. much less formal
> and not officially laid down styles
> {yes: "s".. but we still have a few parts we agree on...}
>
> 2nd problem with any style guide: "Base R" already comes
> with several thousand of functions, classes and other objects, which
> have grown from more than 20 years of S, S+ and then R history,
> and most things cannot feasibly be changed now (or could, say 5
> years ago), for back compatibility reasons.
>
> Further,... more philosophically:
> For many of us, programming (R or otherwise) is considered
> a creative activity to quite some extent, and creativity can be
> crushed by too rigid rules.  I'd state that cultural history
> shows that human culture implicitly follows many rules, but it
> is (almost) only interesting because the are enough exceptions
> to those rules.
>
> Martin Maechler
>       @ ETH Zurich and R Core Team since its inception
>       but speaking entirely for myself ..
>


-- 
"Men by nature long to get on to the ultimate truths, and will often
be impatient with elementary studies or fight shy of them. If it were
possible to reach the ultimate truths without the elementary studies
usually prefixed to them, these would not be preparatory studies but
superfluous diversions."

-- Maimonides (1135-1204)

Bert Gunter
Genentech Nonclinical Biostatistics



More information about the R-help mailing list