[R] replace NA value with 0

S Ellison S.Ellison at lgc.co.uk
Fri Sep 14 11:22:36 CEST 2007



>>On Fri, Sep 14, 2007 at 09:46:57AM +0100, S Ellison wrote:
>> 
>>... only you probably shouldn't be doing that at all. Words like 'bias' spring to mind...
>> 
>> Woudn't it be better to accept the NA's and find methods that handle them as genuinely missing. 
>> R is usually quite good at that.

And Gabor Csardi <csardi at rmki.kfki.hu> replied 

>Although in some cases the proper handling of NA values is to treat 
>them az zeros.... 
Yup. And sometimes not...

>I like this list because if you ask a question, 
>they don't only solve it immediately (in five different ways), but they
>persuade you that what you're trying to do is actually 
>incorrect/stupid/uninteresting or your problem just makes no sense at all.
>:)

Being a chemist, I have to confess that I can't always tell that what I'm about to attempt is barking, trivial, uninteresting or better done a completely different way; myself, I'd rather be warned too often than left to dig my own pit and fall into it ... 

On NA's vs zero, I usually have the reverse problem in my corner of the world; folk will often call nondetects 'missing', which is also often a silly thing to do; nondetect means 'I looked and it was too low to see' but NA means 'I didn't look'. All that leaves me a bit nervous about replacing NA with 0 and vice versa ... hence the knee-jerk. Apologies if I'm teaching egg-sucking to an expert. 

S

*******************************************************************
This email and any attachments are confidential. Any use, co...{{dropped}}



More information about the R-help mailing list