[R] Precedence and parentheses

Göran Broström goran.brostrom at umu.se
Tue May 6 20:09:12 CEST 2014


A thread on r-devel ("Historical NA question") went (finally) off-topic, 
heading towards "Precedence". This triggered a question that I think is 
better put on this list:

I have been more or less regularly been writing programs since the 
seventies (Fortran, later C) and I early got the habit of using 
parentheses almost everywhere, for two reasons. The first is the 
obvious, to avoid mistakes with precedences, but the second is almost as 
important: Readability.

Now, I think I have seen somewhere that unnecessary parentheses in  R 
functions may slow down execution time considerably. Is this really 
true, ant should I consequently get rid of my faiblesse for parentheses?
Or are there rules for when it matters and doesn't matter?

Thanks, Göran



More information about the R-help mailing list