problem with NA
1
0
Entering edit mode
@alberto-goldoni-711
Last seen 9.7 years ago
Hi to everybody, i have a little problem with some values: when I type: 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 ? best wishes Dr Alberto Goldoni Medical Genetics Unit S. Orsola-Malpighi Hospital Via Massarenti n.9, Pad 11 40100 Bologna, Italy Mobile Phone: +39-338-4145970 Fax: +39-051-636-4004 alberto.goldoni at eurogene.org www.eurogene.org www.lagem.it
Genetics Genetics • 751 views
ADD COMMENT
0
Entering edit mode
@saroj-mohapatra-1446
Last seen 9.7 years ago
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
ADD COMMENT

Login before adding your answer.

Traffic: 814 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6