Lists the parts of a Calendar as a tree: its properties and the
columns of the leaftable. Each part carries one of three marks, defined by
the identity of the object (calendar_id()), which is computed from the
timeframe names and the members in the timeframe columns:
Arguments
- calendar
A
Calendar.
Value
A data.frame of class scale_tree, one row per part: part, the
parent property it belongs to ("" for a property), its kind,
shape, mark, the verb that changes it and a note. Printing it
draws the tree.
Details
fixed: the part enters the identity. Changing it gives another calendar; the route is to build a new one.derived: the part is computed from another one and is never set.mutable: the part can change and the calendar stays the same one. The function that changes it is named where there is one.
The marks describe the object; they are not enforced on assignment.
str() on a Calendar prints the same tree.
Examples
calendar_tree(calendar("m12_h24"))
#> <Calendar> m12_h24@c15c0ad6
#> ├─ leaftable data.frame [288 x 6] one row per leaf
#> │ ├─ HOUR leaf column fixed
#> │ ├─ MONTH frame fixed
#> │ ├─ total weight mutable share x width x weight: the part of the year it stands for
#> │ ├─ share column mutable one unit of HOUR (1 h), as a fraction of the year
#> │ ├─ width column mutable length on the time axis, in units
#> │ └─ weight column mutable times the timeslice repeats; 0 leaves it out
#> ├─ timeframes chr [2] fixed MONTH, HOUR
#> ├─ members list [2] derived from leaftable: MONTH 12, HOUR 288
#> ├─ leaf chr [1] fixed HOUR
#> ├─ meta list [11] mutable name, desc, year_start, utc_offset_minutes, year_fraction, tokens, units, weights, ... (11 total)
#> ├─ attributes data.frame [0 x 10] mutable attach_attributes_scale()
#> ├─ aliases data.frame [0 x 4] mutable attach_aliases_scale()
#> └─ labels data.frame [0 x 4] mutable attach_labels_scale()
tr <- calendar_tree(calendar("m12_h24"))
tr$part[tr$mark == "fixed"]
#> [1] "HOUR" "MONTH" "timeframes" "leaf"
