[R] if/else scope

2011-11-15 Thread Kevin Burton
What is wrong with the following? x - 1:2 if(x[1] 0) { if(x[2] 0) { print(1 2 0) } else { print(1 0) } } else {

Re: [R] if/else scope

2011-11-15 Thread Peter Langfelder
On Tue, Nov 15, 2011 at 3:46 PM, Kevin Burton rkevinbur...@charter.net wrote: What is wrong with the following? AFAIK the else needs to follow the end brace of if {} on the same line, at least at the main level. Peter x - 1:2 if(x[1] 0) {                if(x[2] 0)              

Re: [R] if/else scope

2011-11-15 Thread Ben Tupper
Hi, Check out this R-help thread from 2007. http://tolstoy.newcastle.edu.au/R/e2/help/07/06/19513.html Cheers, Ben On Nov 15, 2011, at 6:46 PM, Kevin Burton wrote: What is wrong with the following? x - 1:2 if(x[1] 0) { if(x[2] 0) {

Re: [R] if/else scope

2011-11-15 Thread P.B. Lecavalier
On 11/15/2011 06:46 PM, Kevin Burton wrote: What is wrong with the following? x- 1:2 if(x[1] 0) { if(x[2] 0) { print(1 2 0) } else {