Dear all. After much grief I have finally found the source of some weird discrepancies in results generated using R. It turns out that this is due to the way R handles multi-line expressions. Here is an example with R version 2.8.1:
---------------------------------------------------- # R-script... r_parse_error <- function () { a <- 1; b <- 1; c <- 1; d <- a + b + c; e <- a + b + c; f <- a + b + c; cat('a',a,"\n"); cat('b',b,"\n"); cat('c',c,"\n"); cat('d',d,"\n"); cat('e',e,"\n"); cat('f',f,"\n"); } ---------------------------------------------------- > r_parse_error(); a 1 b 1 c 1 d 3 e 3 f 1 ---------------------------------------------------- As far as I am concerned f should have the value 3. This is causing me endless problems since case f is our house style for breaking up expressions for readability. All our code will need to be rechecked as a result. Is this behaviour a bug? If not, is it possible to get R to generate a warning that several lines of an expression are potentially being ignored, perhaps by turning on a strict mode which requires the semi-colons? Thank you, Paul ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.