RE: [R] syntax error in function 'for'

About this list Date view Thread view Subject view Author view Attachment view

From: John Fox (jfox@mcmaster.ca)
Date: Thu 06 May 2004 - 01:53:17 EST


Message-id: <20040505155316.TSFR11783.tomts22-srv.bellnexxia.net@JohnDesktop8300>

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: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@stat.math.ethz.ch] 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
>
> --

______________________________________________
R-help@stat.math.ethz.ch 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


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:07 EST