fill_s2ts | R Documentation |
Fill temporal gaps in a time series smoothed with function
smooth_s2ts()
to obtain homogeneous values (daily or with a regular
time step).
fill_s2ts(
ts,
frequency = "daily",
method = "fmm",
max_na_days = Inf,
max_extrapolation = 0.1
)
ts |
Time series in |
frequency |
(optional) One of the followings:
|
method |
(optional) Argument passed to |
max_na_days |
(optional) maximum number of consecutive days with missing values which can be filled (in case of longer time windows with missing data, NA are returned). Default is to fit everything (unless this could lead to errors in case of long NT time windows, currently it is the only way to get subsequent functions working). |
max_extrapolation |
(optional) Numeric: maximum allowed extrapolation out of original range (relative value). Default is 0.1 (+10%). Set to Inf in order not to set any constraint. |
The output time series in tabular format (see extract_ts()
).
Luigi Ranghetti, PhD (2020) luigi@ranghetti.info
#' # Load input data
data("ts_smoothed")
# Gap filling using default parameters (daily)
ts_filled <- fill_s2ts(ts_smoothed)
ts_filled # standard print
head(as.data.frame(ts_filled)) # see content
plot(ts_filled)
# Generate a regular time series using the minimum number of required records
ts_filled_2 <- fill_s2ts(ts_smoothed, frequency = "dop")
print(ts_filled_2, topn = 5) # standard print
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.