Hello, would someone please help explain the following inconsistency in the if/else statement to me?
The format of the if/else #3 below is ok, but if/else #1 is not? (I get an "unexpected else" type error.) In order for it to work I have to use if/else #2 Thanks .. maybe there is some reason for this, but this looks very inconsistent to me. R version 2.10.1 (2009-12-14) Ubuntu 9.04 Esmail --------------- #if (ZELIG) ######## if/else #1 # cat(sprintf("Zelig for %d runs - timeR\n", RUNS)) #else # cat(sprintf("lme for %d runs - timeR\n", RUNS)) if (ZELIG){ ####### if/else #2 cat(sprintf("Zelig for %d runs - timeR\n", RUNS)) } else { cat(sprintf("lme for %d runs - timeR\n", RUNS)) } cat(date()," start - timeR\n") for(i in 1:RUNS) { if (ZELIG) ##### if/else #3 do_Zelig() else do_lme() cat(i, ' - ', date(),"\n") } cat(date()," end - timeR\n") sink() ______________________________________________ R-help@r-project.org 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.