tsibble icon indicating copy to clipboard operation
tsibble copied to clipboard

Is it possible to support other date-time classes as indices other than yearmonth/yearquarter?

Open zemw opened this issue 3 years ago • 1 comments

Currently tsibble only supports native date-time classes and tsibble's internally defined classes (yearweek, yearmonth, yearquarter). The problem is only packages from tidyverts recognises these date-time classes. For example, ggplot2 does not recognise yearmonth natively without specifying scale_x_yearmonth. Furthermore, as yearmonth/yearquarter stores values as integers internally rather than fractions of the year (year plus 0 for January, 1/12 for February, 2/12 for March and so on), it is very hard to convert tsibble to ts or zoo objects and makes it prohibitive to interoperate with other time series packages.

What's better to expect:

  • tsibble works just like tibble without additional caution (works with ggplot2 and other tidyverse operations smoothly) only with enhanced time series features.
  • tsibble works with zoo::yearmon or zoo::yearqtr as time indices. This will make tsibble much more versatile and interoperable.
  • It would be even better if tsibble provides functions to coerce to and from non-tidy time series class (e.g. ts).

zemw avatar Feb 03 '22 04:02 zemw

FYI:

  • {tsibble} supports zoo::yearmon and zoo::yearqtr.
  • as_tsibble() handles the coercion of ts to a tsibble, and as.ts() vice versa. The {tsbox} package provides more functions to coerce between time series classes.

earowang avatar Oct 09 '22 03:10 earowang