[R] Google's R Style Guide

Corrado ct529 at york.ac.uk
Sat Aug 29 18:03:23 CEST 2009


I do not understand why one should use a S3 preferentially on a S4 class, if 
S4 is more rigorous.

(The premiss is I am a newbie with OO programming in R, and would like to 
understand what is the "proper" way to OO program in R ....)

Regards



On Saturday 29 August 2009 16:23:39 hadley wickham wrote:
> >> An opening curly brace should never go on its own line;
> >
> > I tend to do this:
> >
> > f <- function()
> > {
> >  if (TRUE)
> >    {
> >      cat("TRUE!!\n")
> >    } else {
> >      cat("FALSE!!\n")
> >    }
> > }
> >
> > (I don't usually put one-liners in if/else blocks; here I would have
> > used ifelse)
> >
> > I haven't seen many others format code in this way. Is there an
> > objective reason for this (such as the rule for the trailing "}") or
> > is this just aesthetics?
>
> It's probably just aesthetics.  I don't like it because it increases
> the number of lines without much real benefit - indenting already
> gives you all the hints you need.
>
> Hadley



-- 
Corrado Topi

Global Climate Change & Biodiversity Indicators
Area 18,Department of Biology
University of York, York, YO10 5YW, UK
Phone: + 44 (0) 1904 328645, E-mail: ct529 at york.ac.uk




More information about the R-help mailing list