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

--
View this message in context: 
http://r.789695.n4.nabble.com/stop-calculation-in-a-function-tp4622964p4623391.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to