[R] Coding style query (braces)

Mike Prager mike.prager at noaa.gov
Wed Oct 25 22:44:23 CEST 2006


Re:  placement of braces and "else" clauses.  At the R prompt, I
believe their placement must avoid causing a syntactically
complete statement at the wrong place.  This can results in what
might be considered rather awkward looking code.

IF it is known that code will be used via sourcing a script
only, is there any potential problem with placing braces as
shown below ?

xxx <- function()
{
	blah()
	if (x > 3)
		{ 
		... if statements here ...
		}
	else
		{
		... else statements here ...
		}

}	# end function


This is code that I would like to work not just now, but in
years to come.

Comments appreciated.

-- 
Mike Prager, NOAA, Beaufort, NC
* Opinions expressed are personal and not represented otherwise.
* Any use of tradenames does not constitute a NOAA endorsement.



More information about the R-help mailing list