SteffenMoritz / imputeTS

CRAN R Package: Time Series Missing Value Imputation
http://steffenmoritz.github.io/imputeTS/
GNU General Public License v3.0
158 stars 25 forks source link

na_replace doesn't allow replacement full NA vector #41

Closed jmablans closed 5 years ago

jmablans commented 5 years ago

Dear Steffen,

Thanks for this nice package. Is there a reason the na_replace function doesn't allow for a vector filled with only NA's to be replaced with values?

If so, the error message if (all(missindx)) { stop("Input data has only NAs. Input data needs at least 1 non-NA data point for applying na_mean") } seems to contain an type. Shouldn't it be: ... for applying _na_replace_ ?

If not, could the check # 1.3 Check for algorithm specific minimum amount of non-NA values be removed? (If you prefer, I will happily do a PR to adjust is myself).

Cheers,

Jan

SteffenMoritz commented 5 years ago

Hey Jan, thanks a lot for opening an issue and the nice suggestions :)

This is definitely an error. I gave it a quick thought and I think as you suggested is the best solution to allow all NA vectors here. (since na_replace is the only provided function that can actually be used with all NA vectors)

I will directly try to make an update - should be a quick fix :)

jmablans commented 5 years ago

You're welcome!

Thanks for the update, keep up the good work!

SteffenMoritz commented 5 years ago

Fixed it, on Github already :-) Will be included in the next CRAN update (which will be probably in 1 or 2 month)

And as I said many thanks for reporting this issue!

Mentioned you in the package News: https://github.com/SteffenMoritz/imputeTS/blob/master/NEWS.md