[R] Google's R Style Guide
hadley wickham
h.wickham at gmail.com
Sat Aug 29 17:23:39 CEST 2009
>> 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
--
http://had.co.nz/
More information about the R-help
mailing list