[R] stop calculation in a function

Sarah Goslee sarah.goslee at gmail.com
Thu May 10 14:46:15 CEST 2012


You're moving the goal posts. If you need to deal with internal as
well as terminal NA values in a particular way, it would help to have
told us that up front.

Please give us some sample data that illustrates what you're really
trying to work with, and a full explanation of what you need to
accomplish.

Sarah

On Thu, May 10, 2012 at 8:41 AM, jeff6868
<geoffrey_klein at etu.u-bourgogne.fr> wrote:
> Thanks for your answer too Berend.
> Yes you're right about x[i+1]. You answered juste before me.
> Well your idea of declaring all in numeric is great. It avoids my problem.
> But actually I also have small missing data gaps in the rest of my data (in
> the middle of numeric values).
> And one of the aim of my function is to avoid comparison between 2 numeric
> values which are separated with a long period of time (with NA inside), in
> order for example not to compare a value of the 1st january and the next
> numeric value of the 1st april.
> I'm trying to combine both. For the moment, it works only for data which
> doesn't ends with NAs as you've understood. With numeric() for st1, the
> problem of NAs at the end is solved but it creates a new problem with the
> other NAs (which was OK before). Do you better understand what I'm trying to
> do?
> If you have an other idea, It'll be welcomed.
> Thanks
>

-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list