Dear Ulrich, I believe that you want ifelse(), not if(), but there are likely some other problems lurking here: You're removing missing data independently from the several vectors -- unless the NAs are all in the same places, things will not work or not work correctly. As well, what do you want to happen if the condition fails?
John > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Ulrich Leopold > Sent: Wednesday, May 05, 2004 10:06 AM > To: R-help > Subject: [R] syntax error in function 'for' > > 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 > > -- ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
