dr_metric_set()
Captures named summary expressions without evaluating them. Returns an
ordinary named list of
dr_metric() definitions for dr_measure(metrics = ...).
Each id combines the product id and expression name, separated by a dot.
Business approval is explicit; exploratory definitions need no code version.
dimensions lists permitted grouping and filtering columns; it does not
choose a report layout. Select the grouping with dr_measure(by = "company")
or request an overall total explicitly with dr_measure(by = character()).
Usage
dr_metric_set(
product,
...,
dimensions = character(),
time_column = NULL,
time_behavior = if (is.null(time_column)) "flow" else "stock",
units = "",
owner = "",
version = "1.0.0",
approved = FALSE,
code_version = NULL,
na_policy = "reject"
)Arguments
- product
- Input asset id shared by all metrics.
- ...
- Named tidy summary expressions, as in
dplyr::summarise(). - dimensions, time_column, owner, version, approved, code_version, na_policy
- Shared arguments passed to
dr_metric(). - time_behavior
- One shared
"stock"or"flow"value, or a named vector covering every metric. Defaults to stock with a time column. - units
- One shared unit, or a named vector. Omitted names have no unit.
Value
An ordinary named list of
metric definitions.
Examples
definitions <- dr_metric_set(
"orders", total = sum(amount), count = dplyr::n(),
dimensions = "company", units = c(total = "EUR")
)Documentation source snapshot · View source at 513e09e ↗
Code examples are documented source examples; they are not executed in this website build.
Code examples are documented source examples; they are not executed in this website build.