[R] How to replace NA's data with some value

Collin Lynch collinl at cs.pitt.edu
Tue Nov 12 19:15:40 CET 2013


Dila, take a look at this:

http://r.789695.n4.nabble.com/How-to-replace-all-lt-NA-gt-values-in-a-data-frame-with-another-not-0-value-td2125458.html

	Does that help?
	Best,
	Collin.

On Tue, 12 Nov 2013, dila radi wrote:

> Hi all,
>
> I have a data set with missing value. I would like to estimate those
> missing value by using normal ratio method.
> Below is part of my data:
>
>       AS   BL Serdang  Jhr   Phg  Target station
>        0    0.0    12.8      0.0  23.7  0.0
>        6    0.0    81.7      0.2  0.0   NA
>        0    1.5    60.9      0.0  0.0   15.5
>        1   13.0    56.8     17.5 32.8  6.4
>        4     3.0    66.4      2.0  0.3   NA
>
> Now I want to replace those NA's,  with the estimation values by using this
> formula:
> weight$v6
> <-(weight1*AS)+(weight2*BL)+(weight3*Serdang)+(weight4*Jhr)+(weight5*Phg);
> Targetstation
>
> but I still could not replace the NA's. My problem is, how do I replace
> those NA's with another value?
>
> Thank you so much for your help and attention.
>
> Regards,
> Dila
>
> 	[[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.
>



More information about the R-help mailing list