Displaying 1 result from an estimated 1 matches for "test_if_else".
Did you mean:
test_if_else2
2003 Nov 13
4
Problem with parser and if/else
Dear r-help people,
could you confirm that this is correct behaviour for R? I am using RH9.
the code:
x1 <- 1:6
t1 <- 5
if (length(x1) >= t1) {
cat("in the if \n")
} else {
cat("in the else\n")
}
runs fine:
> source("test_if_else.R")
in the if
>
but the code:
x1 <- 1:6
t1 <- 5
if (length(x1) >= t1) {
cat("in the if 2\n")
}
else {
cat("in the else\n")
}
fails with the error:
> source("test_if_else2.R")
Error in parse(file, n, text, prompt) : syntax error on line 6
>...