Skip to content
Prev 82384 / 398502 Next

R is GNU S, not C.... [was "how to get or store ....."]

On Tue, Dec 06, 2005 at 04:21:01PM +0000, Patrick Burns wrote:
I don't understand. It would seem to me that in

    if (x > 0) y <- 4;
    else y <- 4.5e23;

it's pretty obvious that the "if" statement is terminated by the
semicolon at the end of the first line and that therefore, the "else"
on the next line is erroneous because it is not associated with any
"if".

At least, the version above fails consistently, i.e. regardless of
context. On the other hand, I've studied the R Language Definition for
quite some time before fully understanding why

    if (x > 0) y <- 4
    else y <- 4.5e23

works inside of a function (or other enclosing block) while it does not
work interactively (or at the top level of a script).

Best regards, Jan

Thread (33 messages)

shanmuha boopathy how to get or store the intermediate v?lues while running a function Dec 6 vincent@7d4.com how to get or store the intermediate v?lues while running a function Dec 6 Martin Maechler R is GNU S, not C.... [was "how to get or store ....."] Dec 6 Adaikalavan Ramasamy R is GNU S, not C.... [was "how to get or store ....."] Dec 6 Philippe GROSJEAN R is GNU S, not C.... [was "how to get or store ....."] Dec 6 Adaikalavan Ramasamy R is GNU S, not C.... [was "how to get or store ....."] Dec 6 vincent@7d4.com R is GNU S, not C.... [was "how to get or store ....."] Dec 6 Brian Ripley R is GNU S, not C.... [was "how to get or store ....."] Dec 6 Xiaofan Li R is GNU S, not C.... [was "how to get or store ....."] Dec 6 Jan T. Kim R is GNU S, not C.... [was "how to get or store ....."] Dec 6 Peter Ehlers R is GNU S, not C.... [was "how to get or store ....."] Dec 6 Barry Rowlingson R formatting Dec 6 Patrick Burns R is GNU S, not C.... [was "how to get or store ....."] Dec 6 Peter Dalgaard R formatting Dec 6 Martin Maechler R is GNU S, not C.... [was "how to get or store ....."] Dec 6 Barry Rowlingson R formatting Dec 6 vincent@7d4.com R is GNU S, not C.... [was "how to get or store ....."] Dec 6 (Ted Harding) R is GNU S, not C.... [was "how to get or store ....."] Dec 6 Deepayan Sarkar R is GNU S, not C.... [was "how to get or store ....."] Dec 6 (Ted Harding) R is GNU S, not C.... [was "how to get or store ....."] Dec 6 Patrick Connolly R is GNU S, not C.... [was "how to get or store ....."] Dec 6 Philippe GROSJEAN R is GNU S, not C.... [was "how to get or store ....."] Dec 6 Patrick Connolly R is GNU S, not C.... [was "how to get or store ....."] Dec 6 vincent@7d4.com R is GNU S, not C.... [was "how to get or store ....."] Dec 6 Peter Ehlers R is GNU S, not C.... [was "how to get or store ....."] Dec 7 Dave Roberts R is GNU S, not C.... [was "how to get or store ....."] Dec 7 Gabor Grothendieck R is GNU S, not C.... [was "how to get or store ....."] Dec 7 Jan T. Kim R is GNU S, not C.... [was "how to get or store ....."] Dec 7 Jim Lemon R is GNU S, not C.... [was "how to get or store ....."] Dec 7 Deepayan Sarkar R is GNU S, not C.... [was "how to get or store ....."] Dec 7 Brian Ripley R coding style (was R is GNU S, not C....) Dec 7 Martin Maechler R is GNU S, not C.... [was "how to get or store ....."] Dec 7 vincent@7d4.com R coding style (was R is GNU S, not C....) Dec 8