I have a dataset like below:
Date Metric1 Metric2 Metric3 Metric4
2017-01-01 NA 3 NA 7
2017-01-02 NA 4 NA 10
2017-01-03 NA 2 NA 18
2017-01-04 5 8 NA 20
2017-01-05 8 9 87 34
2017-01-06 10 2 45 12
. . . . .
. . . . .
. . . . .
2018-09-01 12 13 14 15
2018-09-02 34 12 28 19
2018-09-03 45 12 45 34
2018-09-04 NA 14 49 11
2018-09-05 NA 11 90 12
2018-09-06 NA 15 NA 32
2018-09-07 NA 23 NA 43
2018-09-08 NA 12 NA 22
My dataset has 100 columns. There are no missing values in between the NA
s in their respective columns. Does anyone know a package or a function that will forecast or use a moving average for the values before and after the first or last numeric value?
I have done some research on this so far and the best I can find is na.fill
but that will just repeat values at the beginning and end of columns.