shorvalu {dataprep} | R Documentation |
Interpolation with values to refer to within short periods
Description
Time gaps and available values are considered in NA interpolation by shorvalu
. Thus, more reliable interpolation is realized with these constraints and the successive using of obsedele
in the preceding outlier removal.
Usage
shorvalu(data, start, end, intervals = 30, units = 'mins')
Arguments
data |
A data frame containing outliers. Its columns from |
start |
The column number of the first selected variable. |
end |
The column number of the last selected variable. |
intervals |
The time gap of dividing periods as groups, is 30 (minutes) by default. This confines the interpolation inside short periods so that each interpolation has observed value(s) to refer to within every half an hour. |
units |
Units in time intervals/differences. It can be one of "secs", "mins", "hours", "days", or "weeks". The default is 'mins'. |
Details
It offers a robust interpolation method based on considering time gaps and available values.
Value
A data frame with missing values being replaced linearly within short periods and with values to refer to.
Author(s)
Chun-Sheng Liang <liangchunsheng@lzu.edu.cn>
References
1. Example data is from https://smear.avaa.csc.fi/download. It includes particle number concentrations in SMEAR I Varrio forest.
2. Wickham, H., Francois, R., Henry, L. & Muller, K. 2017. dplyr: A Grammar of Data Manipulation. 0.7.4 ed. http://dplyr.tidyverse.org, https://github.com/tidyverse/dplyr.
3. Wickham, H., Francois, R., Henry, L. & Muller, K. 2019. dplyr: A Grammar of Data Manipulation. R package version 0.8.3. https://CRAN.R-project.org/package=dplyr.
4. Zeileis, A. & Grothendieck, G. 2005. zoo: S3 infrastructure for regular and irregular time series. Journal of Statistical Software, 14(6):1-27.
5. Zeileis, A., Grothendieck, G. & Ryan, J.A. 2019. zoo: S3 Infrastructure for Regular and Irregular Time Series (Z's Ordered Observations). R package version 1.8-6. https://cran.r-project.org/web/packages/zoo/.
Examples
shorvalu(condextr(obsedele(data[1:250,c(1,4,17:19)],3,5,2,cores=2),
3,5,2,cores=2),3,5)