[BioC] problem with NA

Saroj Mohapatra smohapat at vbi.vt.edu
Fri Oct 7 14:34:37 CEST 2005


Alberto Goldoni wrote:

>	tmp <- read.table("tottimecourse.txt", sep="\t", header=T,
>na.strings = "")
>
>some data appear with "NA" value.....:
>
>
>[232] -1.64 -0.98 -0.48 -2.18 -0.41  0.07  0.03    NA -1.17 -0.70 -1.80
>-0.95 -0.74 -0.66 -0.33    NA    NA    NA    NA    NA    NA
>[253]    NA    NA    NA    NA    NA    NA    NA    NA -0.65  0.84 -0.59
>0.01 -0.16 -0.71    NA    NA    NA    NA    NA    NA    NA
>[274]    NA    NA    NA    NA    NA    NA    NA    NA    NA    NA    N
>
>
>how can i apply a function in order to transfor "NA" with 0 ?
>
If you want to replace "NA" with 0, the following might work:

 > tmpIsNA = is.na(tmp)
 > newTmp = tmp
 > newTmp[tmpIsNA] = 0

Best,

Saroj


More information about the Bioconductor mailing list