On 2/16/07, Nicolas Degallier <[EMAIL PROTECTED]> wrote:
>
> Dear R'helpers,
>
> I guess the solution is trivial but despite some hours of testing and
> looking at the doc, I was unable to fix the following problem.
>
> I want to do either:
>
> for (i in 1:lat) a[i,which(a[i,]==0] <- NA


a[a == 0] <- NA

or:
> for (i in 1:lat) a[i,which(a[i,]==-9999|a[i,]==9999|a[i,]==9998|a[i,]
> ==-9998)] <- NA


a[a %in% c(9999, -9999, 9998, -9998)]  <- NA

if the word "Time" is or is not present in variable "nomfichier":
> test<-grep("Time",nomfichier)
>
> the controlling test would be:
>
> if (test==1)
>
> But in either cases I obtain:
>
> if (grep("Time",nomfichier)>0) for (i in 1:lat) a[i,which(a[i,]==0]
> <- NA
> Erreur : syntax error
>
> > if (grep("Time",nomfichier)<>0) {for (i in 1:lat) a[i,which(a[i,]
> ==-9999|a[i,]==9999|a[i,]==9998|a[i,]==-9998)] <- NA}
> Erreur : syntax error
> >
>
> I would appreciate if someone can show me the right way to do this.
>
> Sincerely
> Nicolas
>
> Nicolas Degallier
>
> UMR 7159 / IRD UR182
> Laboratoire d'Océanographie et du Climat, Expérimentation et
> Approches Numériques (LOCEAN)
> Tour 45-55, 4e ét., case 100, 4 place Jussieu
> 75252  Paris Cedex 5  France
> tél: (33) 01 44 27 51 57
> fax: (33) 01 44 27 38 05
>
> E-mail: <[EMAIL PROTECTED]>
> pdf reprints (login="anonymous"; password="[EMAIL PROTECTED]"):
> ftp://ftp.locean-ipsl.upmc.fr/LOCEAN/ndelod
>
> ______________________________________________
> R-help@stat.math.ethz.ch 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

        [[alternative HTML version deleted]]

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

Reply via email to