[R] replace NA value with 0

S Ellison S.Ellison at lgc.co.uk
Fri Sep 14 10:46:57 CEST 2007



>>> Gabor Csardi <csardi at rmki.kfki.hu> 14/09/2007 09:27:03 >>>
>x[ is.na(x) ] <- 0
>
>should work in most cases i think.

... 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.

On Fri, Sep 14, 2007 at 10:08:19AM +0200, Alfredo Alessandrini wrote:
> Hi,
> 
> how can I replace NA value with 0:


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



More information about the R-help mailing list