Displaying 1 result from an estimated 1 matches for "ecart_temp".
Did you mean:
ecart_temps
2012 May 10
1
stop calculation in a function
...fix this problem?
Here's the function. Thanks for your advises!
out2NA <- function(x,seuil){
st1 = NULL
# Temporal variable memorysing the last "correct" numeric value#
temp <- st1[1] <- x[1]
ind_temp <- 1
# Max time gap between two comparisons #
ecart_temps <- 10
tps <- time(x)
for (i in 2:length(x)){
if((!is.na(x[i]))){
if((tps[i]-tps[ind_temp] < ecart_temps) & (abs(x[i]-temp) > seuil)){
#&(abs(x[i+1]-x[i])<1)){
st1[i] <- NA
}
else {
temp <- st1[i] <- x[i]
ind_temp <- i...