Learn R Programming

scoringutils (version 0.1.7.2)

show_avail_forecasts: Visualise Where Forecasts Are Available

Description

Visualise Where Forecasts Are Available

Usage

show_avail_forecasts(
  data,
  y = "model",
  x = "forecast_date",
  make_x_factor = TRUE,
  summarise_by = NULL,
  collapse_to_one = TRUE,
  by = NULL,
  show_numbers = TRUE,
  facet_formula = NULL,
  facet_wrap_or_grid = "facet_wrap",
  scales = "fixed",
  legend_position = "none"
)

Arguments

data

data.frame with predictions in the same format required for eval_forecasts

y

character vector of length one that denotes the name of the column to appear on the y-axis of the plot

x

character vector of length one that denotes the name of the column to appear on the x-axis of the plot

make_x_factor

logical (default is TRUE). Whether or not to convert the variable on the x-axis to a factor. This has an effect e.g. if dates are shown on the x-axis.

summarise_by

character vector or NULL (the default) that denotes the categories over which the number of forecasts should be summed up. By default (i.e. summarise_by = NULL) this will be all the columns that appear in either x, y, or the facetting formula.

collapse_to_one

logical. If TRUE) (the default), everything not included in by will be counted only once. This is useful, for example, if you don't want to count every single sample or quantile, but instead treat one set of samples or quantiles as one forecast.

by

character vector or NULL (the default) that denotes the unit of an individual forecast. This argument behaves similarly to the by argument in link{eval_forecasts}. By default, all columns are used that are not part of any internally protected columns like "sample" or "prediction" or similar. The by argument is only necessary if collapse_to_one = TRUE to indicate which rows not to collapse to one.

show_numbers

logical (default is TRUE) that indicates whether or not to show the actual count numbers on the plot

facet_formula

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

facet_wrap_or_grid

character. 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

scales

character. The scales argument gets passed down to ggplot. Only necessary if you make use of facetting. Default is "fixed"

legend_position

character that indicates where to put the legend. The argument gets passed to ggplot2. By default ("none"), no legend is shown.

Value

ggplot object with a plot of interval coverage

Examples

Run this code
# NOT RUN {
example1 <- scoringutils::range_example_data_long
show_avail_forecasts(example1, x = "value_date", facet_formula = ~ value_desc)
# }

Run the code above in your browser using DataLab