[R] NA values
Petr Pikal
petr.pikal at precheza.cz
Mon Jun 12 15:04:57 CEST 2006
Hi
yes, but I ****do not**** recommend you to do it
> df<-data.frame(a=1:10, b=11:20)
> df[5,2]<-NA
> df
a b
1 1 11
2 2 12
3 3 13
4 4 14
5 5 NA
6 6 16
7 7 17
8 8 18
9 9 19
10 10 20
> df[is.na(df)]<-1000
> df
a b
1 1 11
2 2 12
3 3 13
4 4 14
5 5 1000
6 6 16
7 7 17
8 8 18
9 9 19
10 10 20
>
but in that case you can not simply compute means, sums and other
values just by e.g.
colSums(df, na.rm=T)
HTH
Petr
On 12 Jun 2006 at 18:18, Arun Kumar Saha wrote:
Date sent: Mon, 12 Jun 2006 18:18:33 +0530
From: "Arun Kumar Saha" <arun.kumar.saha at gmail.com>
To: "r-help at stat.math.ethz.ch" <R-help at stat.math.ethz.ch>
Subject: [R] NA values
> Dear all R users,
>
> I am wondering whether there is any way to replace all "NA" values in
> a data frame by some numerical value, suppose 1000?
>
> Thanks and Regards
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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
Petr Pikal
petr.pikal at precheza.cz
More information about the R-help
mailing list