timekit: A Collection of Tools for Working with Time Series in R

> library(timekit)

バージョン: 0.2.0


関数名 概略
timekit timekit: a toolkit for time series
timekit_internal Internal Functions Used in timekit
tk_augment_timeseries Augment the time series signature to the data
tk_get_timeseries Get summary attributes from a time-series index
tk_get_timeseries_unit_frequency Get the timeseries unit frequency for the primary time scales
tk_get_timeseries_variables Get date or datetime variables (column names)
tk_index Extract an index of date or datetime from time series objects, models, forecasts
tk_make_future_timeseries Make a future time series from an existing time series
tk_tbl Coerce time-series objects to tibble.
tk_ts Coerce time series objects and tibbles with date/date-time columns to ts.
tk_xts Coerce time series objects and tibbles with date/date-time columns to xts.
tk_zoo Coerce time series objects and tibbles with date/date-time columns to xts.
tk_zooreg Coerce time series objects and tibbles with date/date-time columns to ts.

tk_index

Arguments

  • data
  • timekit_idx
  • silent
> data_tbl <- tibble::tibble(
+     date = seq.Date(from = as.Date("2000-01-01"), by = 1, length.out = 5),
+     x    = rnorm(5) * 10,
+     y    = 5:1
+ )
> tk_index(data_tbl)
[1] "2000-01-01" "2000-01-02" "2000-01-03" "2000-01-04" "2000-01-05"

tk_make_future_timeseries

Arguments

  • idx
  • n_future
  • skip_values
  • inspect_weekdays
> idx <- c("2016-01-01 00:00:00",
+          "2016-01-01 00:00:03",
+          "2016-01-01 00:00:06") %>%
+     lubridate::ymd_hms()
> idx %>%
+     tk_make_future_timeseries(n_future = 3)
[1] "2016-01-01 00:00:09 UTC" "2016-01-01 00:00:12 UTC"
[3] "2016-01-01 00:00:15 UTC"

tk_ts

> (data_ts <- tk_ts(data_tbl))
Warning in tk_xts_.data.frame(ret, select = select, silent = silent): Non-
numeric columns being dropped: date
Time Series:
Start = 1 
End = 5 
Frequency = 1 
                 x y
1 -10.554805342820 5
2   0.199496396824 4
3  15.725191348328 3
4  -6.050938703286 2
5   5.526879768766 1
attr(,"index")
[1] 946684800 946771200 946857600 946944000 947030400
attr(,"index")attr(,"tzone")
[1] UTC
attr(,"index")attr(,"tclass")
[1] Date
attr(,".indexCLASS")
[1] Date
attr(,"tclass")
[1] Date
attr(,".indexTZ")
[1] UTC
attr(,"tzone")
[1] UTC