This function generates a data frame summarizing the time features (class, length, resolution, and others) of zoo time series.
Usage
zoo_time(x = NULL, keywords = c("resample", "aggregate"))
Arguments
- x
(required, zoo object) Zoo time series to analyze. Default: NULL.
- keywords
(optional, character string or vector) Defines what keywords are returned. If "aggregate", returns valid keywords for
zoo_aggregate()
. If "resample", returns valid keywords forzoo_resample()
. If both, returns all valid keywords. Default: c("aggregate", "resample").
Value
Data frame with the following columns:
name
(string): time series name.rows
(integer): number of observations.class
(string): time class, one of "Date", "POSIXct", or "numeric."units
(string): units of the time series.length
(numeric): total length of the time series expressed inunits
.resolution
(numeric): average interval between observations expressed inunits
.begin
(date or numeric): begin time of the time series.end
(date or numeric): end time of the time series.keywords
(character vector): valid keywords fortsl_aggregate()
ortsl_resample()
, depending on the value of the argumentkeywords
.
See also
Other zoo_functions:
zoo_aggregate()
,
zoo_name_clean()
,
zoo_name_get()
,
zoo_name_set()
,
zoo_permute()
,
zoo_plot()
,
zoo_resample()
,
zoo_smooth_exponential()
,
zoo_smooth_window()
,
zoo_to_tsl()
,
zoo_vector_to_matrix()
Examples
#simulate a zoo time series
x <- zoo_simulate(
rows = 150,
time_range = c(
Sys.Date() - 365,
Sys.Date()
),
irregular = TRUE
)
#time data frame
zoo_time(
x = x
)
#> name rows class units length resolution begin end keywords
#> 1 A 150 Date days 363.7793 2.441472 2023-12-22 2024-12-19 years, q....