SteffenMoritz/imputeTS

na.seadec replaces zero values

Closed this issue · 4 comments

A error report from stackoverflow:
Unfortunately, I have found that na.seadec replaces zero values as well as NA values. – CameronNemo

I think this is fixed already?

I couldn't reproduce this error. The amount of 0 stayed the same for all different algorithm methods:

n = 20
tsAirgap[sample(1:length(tsAirgap), n)] <- 0

x <- na_seadec(tsAirgap, algorithm = "interpolation")
x1 <- na_seadec(tsAirgap, algorithm = "mean")
x2 <- na_seadec(tsAirgap, algorithm = "locf")
x3 <- na_seadec(tsAirgap, algorithm = "random")
x4 <- na_seadec(tsAirgap, algorithm = "kalman")
x5 <- na_seadec(tsAirgap, algorithm = "ma")

all(c(sum(x==0, na.rm=T),
  sum(x1==0, na.rm=T),
  sum(x2==0, na.rm=T),
  sum(x3==0, na.rm=T),
  sum(x4==0, na.rm=T),
  sum(x5==0, na.rm=T)) == 20)

[1] TRUE

Ah yes, right - this is fixed with the new version :)

Thanks for checking 👍

Thanks for the fix!