Developer Tools for parsing date and date-time information
Source:R/dev-parse_index.R
parse_index.Rd
These functions are designed to assist developers in extending the modeltime
package.
Value
parse_index_from_data(): Returns a tibble containing the date or date-time column.
parse_period_from_index(): Returns the numeric period from a tibble containing the index.
Examples
library(dplyr)
library(timetk)
predictors <- m4_monthly %>%
filter(id == "M750") %>%
select(-value)
index_tbl <- parse_index_from_data(predictors)
index_tbl
#> # A tibble: 306 × 1
#> date
#> <date>
#> 1 1990-01-01
#> 2 1990-02-01
#> 3 1990-03-01
#> 4 1990-04-01
#> 5 1990-05-01
#> 6 1990-06-01
#> 7 1990-07-01
#> 8 1990-08-01
#> 9 1990-09-01
#> 10 1990-10-01
#> # ℹ 296 more rows
period <- parse_period_from_index(index_tbl, period = "1 year")
#> frequency = 12 observations per 1 year
period
#> [1] 12