[R] How to replace all <NA> values in a data.frame with another ( not 0) value

John Kane jrkrideau at yahoo.ca
Tue May 4 15:21:53 CEST 2010


?replace


Something like this should work

replace(df1, is.na(df1), "000/000")

--- On Tue, 5/4/10, Nevil Amos <nevil.amos at gmail.com> wrote:

> From: Nevil Amos <nevil.amos at gmail.com>
> Subject: [R] How to replace all <NA> values in a data.frame with another ( not 0) value
> To: r-help at stat.math.ethz.ch
> Received: Tuesday, May 4, 2010, 8:54 AM
> I need to replace <NA>
> occurrences in multiple columns  in a data.frame with
> "000/000"
> 
> how do I achieve this?
> 
> Thanks
> 
> Nevil Amos
> 
> ______________________________________________
> 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