An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-ecology/attachments/20130728/79b1bdf0/attachment.pl>
How to replace NA values
2 messages · Bruce Miller, Chris Howden
Bats.cast [is.na(Bats.cast)] <- 0 Or Bats.cast [Bats.cast == NA] <- 0 Chris Howden B.Sc. (Hons) GStat. Founding Partner Evidence Based Strategic Development, IP Commercialisation and Innovation, Data Analysis, Modelling and Training (mobile) 0410 689 945 (skype) chris.howden chris at trickysolutions.com.au Disclaimer: The information in this email and any attachments to it are confidential and may contain legally privileged information.?If you are not the named or intended recipient, please delete this communication and contact us immediately.?Please note you are not authorised to copy, use or disclose this communication or any attachments without our consent. Although this email has been checked by anti-virus software, there is a risk that email messages may be corrupted or infected by viruses or other interferences. No responsibility is accepted for such interference. Unless expressly stated, the views of the writer are not those of the company. Tricky Solutions always does our best to provide accurate forecasts and analyses based on the data supplied, however it is possible that some important predictors were not included in the data sent to us. Information provided by us should not be solely relied upon when making decisions and clients should use their own judgement. -----Original Message----- From: r-sig-ecology-bounces at r-project.org [mailto:r-sig-ecology-bounces at r-project.org] On Behalf Of Bruce Miller Sent: Sunday, 28 July 2013 11:14 PM To: r-sig-ecology at r-project.org Subject: [R-sig-eco] How to replace NA values Hi all, I am using reshape2 to reformat a data frame and all is great using: Bats.melt <- melt(data = Bats) Bats.cast <- dcast(data = Bats.melt, formula = Species ~ Location) dput(Bats.cast,'C:/=Bat data working/Nica_new/Bats_niche.robj') write.csv(Bat.cast,'C:/=Bat data working/Nica_new/test_Niche.csv') The resulting file from both dput and write are great, however in order to run another R analysis (new Gotelli EcosimR null models in R) I need to replace all the NA values in the output with a zero - 0 value. I have just been opening this in Excel and using a simple find NA replace with 0 and saving then reopening in R. There must be a simple way to do this in R. Any suggestions welcomed. _______________________________________________ R-sig-ecology mailing list R-sig-ecology at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology