Hi R users,
Maybe the question is too simple.
In a IF ... ELSE ... statement "if(cond) cons.expr else alt.expr", IF and
ELSE should be at the same line?
For example,
if (x1==12)
{
y1 <- 5
}else
{
y1 <- 3
}
is right, while
if (x1==12)
{
y1 <- 5
}
else # Error: syntax error
{
y1 <- 3
}
is wrong?
Thanks
--
Xiaohua Dai
--------------------------------------------------------------------------------
Centre for Systems Research, Durban Institute of Technology
P.O.Box 953, Durban 4000, South Africa
Tel: +27-31-2042737(O) Fax: +27-31-2042736(O)
Mobile: +27-723682954
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html