diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 734ead91..0827abcb 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -42,7 +42,7 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: - extra-packages: any::rcmdcheck + extra-packages: any::rcmdcheck, ggdist=?ignore-before-r=4.1.0 needs: check - uses: r-lib/actions/check-r-package@v2 diff --git a/vignettes/Deprecated-visualisations.Rmd b/vignettes/Deprecated-visualisations.Rmd index 9fab9ce5..492e241b 100644 --- a/vignettes/Deprecated-visualisations.Rmd +++ b/vignettes/Deprecated-visualisations.Rmd @@ -26,7 +26,6 @@ The example data used is the data shipped with the `scoringutils` package. It co library(scoringutils) library(data.table) library(ggplot2) -library(ggdist) library(magrittr) library(magrittr) #pipe operator ``` @@ -35,7 +34,7 @@ library(magrittr) #pipe operator In previous versions of `scoringutils`, forecasts and observed values could be visualised using the function `plot_predictions()` and its `make_na()` helper function. The following shows the function code first and then an example. -```{r} +```{r eval=!require("ggdist", quietly = TRUE)} #" @title Plot Predictions vs True Values #" #" @description @@ -98,6 +97,8 @@ In previous versions of `scoringutils`, forecasts and observed values could be v #" facet_wrap(~ location + target_type, scales = "free_y") + #" aes(fill = model, color = model) + +library(ggdist) plot_predictions <- function(data, by = NULL, x = "date", @@ -277,7 +278,7 @@ In the following are a few examples of using the two functions to create a plot Visualising the median forecasts for the example data. The truth data is restricted to a period between 2021-05-01 and 2021-07-22. The forecast data is a forecast from the model "EuroCOVIDhub-ensemble" made on the "2021-06-07". All other data is set to `NA`, effectively removing it from the plot. -```{r} +```{r eval=!require("ggdist", quietly = TRUE)} median_forecasts <- example_quantile[quantile_level == 0.5] median_forecasts %>% make_NA(what = "truth", @@ -295,7 +296,7 @@ median_forecasts %>% This is the same plot, but with a variety of prediction intervals shown, instead of just the median. -```{r} +```{r eval=!require("ggdist", quiet = TRUE)} example_quantile %>% make_NA(what = "truth", target_end_date <= "2021-05-01", @@ -313,7 +314,7 @@ example_quantile %>% And a similar plot, this time based on continuous forecasts. The predictions are automatically converted to a quantile-based forecasts for plotting. -```{r} +```{r eval=!require("ggdist", quietly = TRUE)} example_sample_continuous %>% make_NA(what = "truth", target_end_date <= "2021-05-01", @@ -331,7 +332,7 @@ example_sample_continuous %>% Displaying two forecasts at a time with additional colours: -```{r} +```{r eval=!require("ggdist", quietly = TRUE)} example_quantile %>% make_NA(what = "truth", target_end_date > "2021-07-15",