While implementing fpp3 Chapter 2 seasonal plots, we needed to extract many time fields and compute derived columns (phases, string conversions) from datetime columns. This raised the question: should tablecloth.time adopt tsibble-like metadata, or stick with explicit composable helpers?
In R, tsibble attaches metadata to data frames:
vic_elec <- as_tsibble(data, index = Time, key = c(State, Region))
From this declaration, tsibble automatically:
gg_season(period = "day")Pros:
Cons:
Extend add-time-columns with more field types. User explicitly requests what they need:
(time-api/add-time-columns ds "Time"
{:daily-phase "DailyPhase"
:year-string "YearStr"
...})
Pros:
Cons:
We chose composable helpers because:
Extended add-time-columns with computed fields:
:hour-fractional, :daily-phase, :weekly-phase — for seasonal x-axes:date-string, :year-string, :month-string, etc. — for grouping/coloring:week-index, :year-week-string — for weekly plots (avoids ISO week issues)seasonal-plot that infers what it needsdoc/tableplot-gaps.mdCan you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |