[R] if confusion

rkevinburton at charter.net rkevinburton at charter.net
Mon Aug 3 22:40:39 CEST 2009


Simple question:

Why doesn't the following work? Or what 'R' rule am I missing?

tclass <-  "Testing 1 2 3"
if(tclass == "Testing 1 2 3")
{
    cat("Testing", tclass, "\n")
}
else
{
    cat(tclass, "\n")
}

I get an error 'else' is unexpected.

Thank you.

Kevin




More information about the R-help mailing list