Description Usage Arguments Details Value Methods (by class) See Also
View source: R/utils-timeseries.R
Generic function tp convert timeseries at specified frequency by setting new frequency of data index
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ts_asfreq(
ts_dataset,
freq_rule = c("day", "month", "quarter", "year"),
fillna_method = c("nfill", "ffill", "bfill"),
...
)
## S3 method for class 'tbl_df'
ts_asfreq(
ts_dataset,
freq_rule = c("day", "month", "quarter", "year"),
fillna_method = c("nfill", "ffill", "bfill"),
...,
date_index_field = c("date"),
key_fields = NULL,
parallel = getOption("zstmodelr.common.parallel", TRUE)
)
## S3 method for class 'timeSeries'
ts_asfreq(
ts_dataset,
freq_rule = c("day", "month", "quarter"),
fillna_method = c("nfill", "ffill", "bfill"),
...
)
|
ts_dataset |
A timeseries of tibble/timeSeries. |
freq_rule |
A offset string or object representing target conversion, e.g. "day", "month", "quarter", "year", default "day". |
fillna_method |
A method to fill NAs in reindexed Series, e.g. "nfill", "ffill", "bfill" . Default "nfill" don't fill NAs; "ffill" means to use data before NAs to fill NAs; "bfill" means to use data after NAs to fill NAs. |
... |
Extra arguments to be passed to methods. |
date_index_field |
Name of date index field of ts_df for refrequecy, default 'date', Column must be date-like. Only be used for tibble dataset. |
key_fields |
A character vector of key fields, which identify unique observation in each date. Only be used for tibble dataset. |
parallel |
A logic to determine whether to use parallel processing. Only be used for tibble dataset. |
Convert timeseries to specified frequency by refrequencing date index. Optionally provide filling method to pad/backfill missing values. Return original data conformed to a new index with the specified frequency.
ts_asfreq is more appropriate if use original the data at the new frequency.
1 | A converted timeseres
|
tbl_df
: Set new frequency for timeseries of tibble dataset
timeSeries
: Set new frequency for timeSeries of timeSeries dataset
Other utils_timeseries:
ts_lag()
,
ts_resample()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.