na.seadec replaces zero values
Closed this issue · 4 comments
SteffenMoritz commented
A error report from stackoverflow:
Unfortunately, I have found that na.seadec replaces zero values as well as NA values. – CameronNemo
trafficonese commented
Just posting the link to the mentioned stackoverflow question + comment:
https://stackoverflow.com/questions/31933850/replace-missing-values-in-a-time-series-dataset-with-both-na-and-zero
trafficonese commented
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
SteffenMoritz commented
Ah yes, right - this is fixed with the new version :)
Thanks for checking 👍
CameronNemo commented
Thanks for the fix!