Skip to contents

Infer frequency of a tsibble and convert its index to date or string.

Usage

date_conversion(df)

Arguments

df

A tsibble.

Value

A list with the inferred frequency and data frame with dates in format yyyy-mm-dd.

Examples

df <- AirPassengers
tsbl <- tsibble::as_tsibble(df)
names(tsbl) <- c("ds", "y")
date_conversion(tsbl)
#> Frequency chosen: MS
#> $df
#> # A tibble: 144 × 2
#>    ds             y
#>    <chr>      <dbl>
#>  1 1949-01-01   112
#>  2 1949-02-01   118
#>  3 1949-03-01   132
#>  4 1949-04-01   129
#>  5 1949-05-01   121
#>  6 1949-06-01   135
#>  7 1949-07-01   148
#>  8 1949-08-01   148
#>  9 1949-09-01   136
#> 10 1949-10-01   119
#> # ℹ 134 more rows
#> 
#> $freq
#> [1] "MS"
#>