[R] R bug? (if-else problem in main program)

Anita Gulyasne Goldpergel anitag at latte.harvard.edu
Wed Nov 6 05:01:36 CET 2002


Hi everybody, 

I've found a very interesting problem in R: the if-else statement doesn't
work in a main program. Sounds crazy, but true. 

I tried this very easy example, and I got syntax error at the "else" line. 

Example:
 -------
a <- 1 

if ( a == 1 )
 print("yes")
else
 print("no")
 -------- 

I tried on Windows and on Linux, but none of them works.
(Detailed version info at the end of the mail.) 

Temporally you could fix it in two way: 

1. Put it in 1 line:
if ( a == 1) print("yes") else print("no")
will work. 

2. Put it in a function. 

If you have any idea for better resolve of this problem,
please send me an email, I'm not subscribed to the list. 

Thanks,
Anita 

Version info: 

1. Windows:
platform i386-pc-mingw32
arch     i386
os       mingw32
system   i386, mingw32
status
major    1
minor    5.0
year     2002
month    04
day      29
language R 

2. Linux:
platform i686-pc-linux-gnu
arch     i686
os       linux-gnu
system   i686, linux-gnu
status
major    1
minor    5.1
year     2002
month    06
day      17
language R 

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list