[R] syntax error in function 'for'
Peter Wolf
s-plus at wiwi.uni-bielefeld.de
Wed May 5 17:14:29 CEST 2004
Ulrich Leopold wrote:
>Dear list,
>
>I get a syntax error for the following function:
>
>for(na.omit(sqrt(D))>2) {na.omit(A)-(na.omit(B)+(na.omit(sqrt(C))))}
>
>Any idea what is wrong?
>
>I am using R 1.8.1 on Linux, Kernel 2.4.21-i686.
>
>Regards, Ulrich
>
>
>
have a look at help("for"):
Control package:base R Documentation
Control Flow
Description:
...
Usage:
if(cond) expr
if(cond) cons.expr else alt.expr
for(var in seq) expr
...
Examples:
for(i in 1:5) print(1:i)
for(n in c(2,5,10,20,50)) {
x <- rnorm(n)
cat(n,":", sum(x^2),"\n")
}
Peter Wolf
More information about the R-help
mailing list