[R] Coding style query (braces)

From: Mike Prager <mike.prager_at_noaa.gov>
Date: Wed 25 Oct 2006 - 20:44:23 GMT


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.
______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Received on Thu Oct 26 08:50:11 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 26 Oct 2006 - 00:30:16 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.