[R] Google's R Style Guide

Max Kuhn mxkuhn at gmail.com
Sat Aug 29 16:53:19 CEST 2009


Perhaps this is obvious, but Ive never understood why this is the
general convention:

> 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?

Thanks,

Max




More information about the R-help mailing list