Osman Buyukisik writes:
> I was playing with porting "Hmisc" S-Lib. I am getting parse
errors for:
> if (xxx) yyyy;else zzzz
>
> I have to break this into:
> if(xxx) yyyy
> else zzzz
>
> Is this a known feature?
Hmmm. Bug or feature?
Note that as you've written it, this does not parse in S either.
However,
{ if (xxx) yyyy;else zzzz }
does.
It works in S because the parser converts ";" immediately into
"\n"
and within "{ ... }" a newline preceding preceding an "else"
is not
significant.
There is a side-effect problem in S which comes out of this quick-fix.
E.g (in S)
> 1;2
[1] 1
> [1] 2
>
Note the extra prompt printed before the second value.
It might be possible to "unfix" this in R, but it's not trivial.
I'd suggest that you make a quick pass through the code removing any
";"s which occur at the end of lines and converting any ";"
immediately before an "else" into a space (or newline).
Ross
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._