Skip to contents

Materialises the from -> timeslices -> to route within one calendar as a table: one row per pair of overlapping members (the nodes of the hierarchy at each timeframe, m01 and m01_h00) with n_from (leaf timeslices in the source member), n_overlap (leaf timeslices the pair shares), w (the weight of the overlap) and w_from (the full weight of the source member). The two label columns are named by the timeframes. A crosswalk registered with register_calendar_map() is returned as-is instead of being derived.

Usage

calendar_map(
  x,
  source,
  target,
  weight = NULL,
  ...,
  from = lifecycle::deprecated(),
  to = lifecycle::deprecated()
)

Arguments

x

The Calendar the timeframes belong to.

source, target

Timeframe names of x.

weight

Weight column for w. NULL uses the calendar's weight, total: the part of the year a timeslice stands for (share x width x weight).

...

Passed to the shared core, e.g. by = for extra identifier columns.

from, to

Deprecated names of source and target.

Value

A data.frame with columns <source>, <target> (NA = uncovered by target), n_from, n_overlap, w, w_from.

See also

calendar_map_between() for the map between two calendars.

Examples

cal <- calendar("m12_h24")
head(calendar_map(cal, "MONTH", "HOUR"))
#>   MONTH    HOUR n_from n_overlap           w     w_from
#> 1   m01 m01_h00     24         1 0.003538813 0.08493151
#> 2   m01 m01_h01     24         1 0.003538813 0.08493151
#> 3   m01 m01_h02     24         1 0.003538813 0.08493151
#> 4   m01 m01_h03     24         1 0.003538813 0.08493151
#> 5   m01 m01_h04     24         1 0.003538813 0.08493151
#> 6   m01 m01_h05     24         1 0.003538813 0.08493151