[R] replacing zeros with above/below numbers ?

ce zadig_1 at excite.com
Thu Feb 6 05:17:09 CET 2014

Yes , indeed this is what I am looking for :

a[ a == 0.0 ] = NA

Thanks a lot.

-----Original Message-----
From: "Jeff Newmiller" [jdnewmil at dcn.davis.CA.us]
Date: 02/05/2014 10:35 PM
To: "ce" <zadig_1 at excite.com>, "" <r-help at r-project.org>
Subject: Re: [R] replacing zeros with above/below numbers ?

You seem to be treating zeroes as unknown values. Perhaps you should consider setting them to NA and using the na.approx function from the zoo package.
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
Sent from my phone. Please excuse my brevity.

On February 5, 2014 7:05:46 PM PST, ce <zadig_1 at excite.com> wrote:
>Dear all,
> My data is :
>a <-
>I want to replace zeros with  average of before and after values of
>them.  But sometimes there is one zero sometimes more than one. What is
>the most elegant way to do this ?
>Thanks a lot
>R-help at r-project.org mailing list
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list