[R] replacing zeros by NAs
tommaso_unifi
tommaso.letterio at unifi.it
Fri Jun 12 12:04:34 CEST 2009
Other method:
a<-matrix(seq(1,20,2), 4,5)
a[c(1:2),c(2:4)]<-0
a[a==0]<-NA
----- Original Message -----
From: "Robert Kinley" <KINLEY_ROBERT at lilly.com>
To: <r-help at r-project.org>
Sent: Friday, June 12, 2009 11:59 AM
Subject: [R] replacing zeros by NAs
> something like ...
>
>> x<-c(1,2,3,0,5,6,0)
>> is.na(x[x==0])<-T
>> x
> [1] 1 2 3 NA 5 6 NA
>
> ~~~~~~~~~~~~~~~~
> Robert Kinley
>
> ~~~~~~~~~~~~~~~~
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org 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.
--------------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG - www.avg.com
17:59:00
More information about the R-help
mailing list