How can we perform imputation on uni-variate, seasonal time series using a linear model approach in R? It should account for seasonality and, preferably, trend. I have used tslm function for forecast but do not know a similar function for imputation.
The the imputeTS package might be what you are searching. (disclaimer: I am maintainer of the package)
It is a package especially for (univariate) time series imputation. This means it also has functions able to handle seasonality and trend.
There are actually several functions in the package that could be of interest for you:
There are also other algorithms included, but these three seem most promising for your needs. I would suggest reading the manual for concrete algorithm details.
Short example for you:
library(imputeTS)
# tsAirgap is a example univariate time series with NAs provided by imputeTS
x <- tsAirgap
x <- na_kalman(x)
That's it basically. For the other algortihms it would work the same:
library(imputeTS)
# tsAirgap is a example univariate time series with NAs provided by imputeTS
x <- tsAirgap
x <- na_seadec(x, algorithm = "interpolation")