[R] how to replace <NA> values
John Kane
jrkrideau at inbox.com
Tue Jan 21 19:07:13 CET 2014
I'm pretty sure that what you have is not what you think you have.
Do a str(Elder1) on the data set and you will see that age is a factor not a numerical variable. Bascally you have a mangled data set from the look of it.
Why would you want to change NA's to 0's?
John Kane
Kingston ON Canada
> -----Original Message-----
> From: ecokingsly at yahoo.co.in
> Sent: Sun, 19 Jan 2014 11:39:43 -0800 (PST)
> To: r-help at r-project.org
> Subject: [R] how to replace <NA> values
>
> Dear R community
> B
> I have a large data set contain some empty cells. BecauseB of that,B may
> be I am wrong, <NA> values are produced.
> Now I want replace both empty and <NA> values with zero.
> B
> Elder1 <- data.frame(
> B ID=c("ID1","ID2","ID3","ID6","ID8"),
> B age=c(38,35,"",NA,NA))
> Output I am expecting
> B
> IDB B age
> ID1B 38
> ID2B 35
> ID3B 0
> ID6B 0
> ID8B 0
> B
> In advance I thank your help.
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/how-to-replace-NA-values-tp4683831.html
> Sent from the R help mailing list archive at Nabble.com.
> [[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.
____________________________________________________________
Send your photos by email in seconds...
TRY FREE IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if3
Works in all emails, instant messengers, blogs, forums and social networks.
More information about the R-help
mailing list