[R] Got "Unexpected ELSE error"

Shiazy Fuzzy shiazy at gmail.com
Wed Jun 20 11:41:08 CEST 2007


Dear R-users,

I have a problem with the IF-ELSE syntax.
Please look at the folllowing code and tell me what's wrong:

a <- TRUE
if ( a )
{
        cat("TRUE","\n")
}
else
{
        cat("FALSE","\n")
}

If I try to execute with R I get:
     Error: syntax error, unexpected ELSE in "else"
The strange thing is either "cat" instructions are executed!!

My system is: Fedora Core 6 x86_64 + R 2.5.0 (rpm)

Thank you very much in advance!!!!

Regards,

-- Marco



More information about the R-help mailing list