Learn R Programming

scoringutils (version 0.1.7.2)

score_table: Plot Coloured Score Table

Description

Plots a coloured table of summarised scores obtained using eval_forecasts

Usage

score_table(
  summarised_scores,
  y = NULL,
  select_metrics = NULL,
  facet_formula = NULL,
  ncol = NULL,
  facet_wrap_or_grid = "facet_wrap"
)

Arguments

summarised_scores

A data.frame of summarised scores as produced by eval_forecasts

y

the variable to be shown on the y-axis. If NULL (default), all columns that are not scoring metrics will be used. Alternatively, you can specify a vector with column names, e.g. y = c("model", "location"). These column names will be concatenated to create a unique row identifier (e.g. "model1_location1")

select_metrics

A character vector with the metrics to show. If set to NULL (default), all metrics present in summarised_scores will be shown

facet_formula

formula for facetting in ggplot. If this is NULL (the default), no facetting will take place

ncol

Number of columns for facet wrap. Only relevant if facet_formula is given and facet_wrap_or_grid == "facet_wrap"

facet_wrap_or_grid

Use ggplot2's facet_wrap or facet_grid? Anything other than "facet_wrap" will be interpreted as facet_grid. This only takes effect if facet_formula is not NULL

Value

A ggplot2 object with a coloured table of summarised scores

Examples

Run this code
# NOT RUN {
scores <- scoringutils::eval_forecasts(scoringutils::quantile_example_data,
                                       summarise_by = c("model", "value_desc"))
scoringutils::score_table(scores, y = "model", facet_formula = ~ value_desc,
                           ncol = 1)

# can also put target description on the y-axis
scoringutils::score_table(scores, y = c("model", "value_desc"))

# yields the same result in this case
scoringutils::score_table(scores)


scores <- scoringutils::eval_forecasts(scoringutils::integer_example_data,
                                        summarise_by = c("model", "value_desc"))
scoringutils::score_table(scores, y = "model", facet_formula = ~ value_desc,
                           ncol = 1)

# only show selected metrics
scoringutils::score_table(scores, y = "model", facet_formula = ~ value_desc,
                           ncol = 1, select_metrics = c("crps", "bias"))
# }

Run the code above in your browser using DataLab