From c709b896eb2174e1c93b00367c996c10ffee99e7 Mon Sep 17 00:00:00 2001 From: nikosbosse Date: Sun, 6 Oct 2024 22:44:56 +0200 Subject: [PATCH] lint for the lint god --- R/class-forecast-quantile.R | 2 +- R/get-coverage.R | 14 ++++++++------ R/get-pit-generic.R | 15 ++++++++------- R/pairwise-comparisons.R | 11 ++++++----- R/plot-wis.R | 9 +++++---- 5 files changed, 28 insertions(+), 23 deletions(-) diff --git a/R/class-forecast-quantile.R b/R/class-forecast-quantile.R index 98fae8de..152121ee 100644 --- a/R/class-forecast-quantile.R +++ b/R/class-forecast-quantile.R @@ -41,7 +41,7 @@ as_forecast_quantile.default <- function(data, #' @rdname assert_forecast #' @keywords validate-forecast-object assert_forecast.forecast_quantile <- function( - forecast, forecast_type = NULL, verbose = TRUE, ... + forecast, forecast_type = NULL, verbose = TRUE, ... ) { forecast <- assert_forecast_generic(forecast, verbose) assert_forecast_type(forecast, actual = "quantile", desired = forecast_type) diff --git a/R/get-coverage.R b/R/get-coverage.R index defde162..d16fc623 100644 --- a/R/get-coverage.R +++ b/R/get-coverage.R @@ -155,9 +155,10 @@ plot_interval_coverage <- function(coverage, colour = "white", fill = "olivedrab3" ) + - geom_line(aes(y = interval_range), - colour = "grey", - linetype = "dashed" + geom_line( + aes(y = interval_range), + colour = "grey", + linetype = "dashed" ) + geom_line(aes(y = interval_coverage * 100)) + theme_scoringutils() + @@ -218,9 +219,10 @@ plot_quantile_coverage <- function(coverage, colour = "white", fill = "olivedrab3" ) + - geom_line(aes(y = quantile_level), - colour = "grey", - linetype = "dashed" + geom_line( + aes(y = quantile_level), + colour = "grey", + linetype = "dashed" ) + geom_line(aes(y = quantile_coverage)) + theme_scoringutils() + diff --git a/R/get-pit-generic.R b/R/get-pit-generic.R index a4839b87..1e7d268e 100644 --- a/R/get-pit-generic.R +++ b/R/get-pit-generic.R @@ -147,9 +147,10 @@ plot_pit <- function(pit, data = pit, aes(x = pit_value) ) + - geom_histogram(aes(y = after_stat(width * density)), - breaks = plot_quantiles, - colour = "grey" + geom_histogram( + aes(y = after_stat(width * density)), + breaks = plot_quantiles, + colour = "grey" ) + facet_wrap(formula) } @@ -159,9 +160,10 @@ plot_pit <- function(pit, data = data.frame(x = pit, stringsAsFactors = TRUE), aes(x = x) ) + - geom_histogram(aes(y = after_stat(width * density)), - breaks = plot_quantiles, - colour = "grey" + geom_histogram( + aes(y = after_stat(width * density)), + breaks = plot_quantiles, + colour = "grey" ) } @@ -172,4 +174,3 @@ plot_pit <- function(pit, return(hist) } - diff --git a/R/pairwise-comparisons.R b/R/pairwise-comparisons.R index ba4b3d3a..d42969f1 100644 --- a/R/pairwise-comparisons.R +++ b/R/pairwise-comparisons.R @@ -667,11 +667,12 @@ plot_pairwise_comparisons <- function(comparison_result, get_fill_scale <- function(values, breaks, plot_scales) { values[is.na(values)] <- 1 # this would be either ratio = 1 or pval = 1 - scale <- cut(values, - breaks = breaks, - include.lowest = TRUE, - right = FALSE, - labels = plot_scales + scale <- cut( + values, + breaks = breaks, + include.lowest = TRUE, + right = FALSE, + labels = plot_scales ) return(as.numeric(as.character(scale))) } diff --git a/R/plot-wis.R b/R/plot-wis.R index d268b237..26a17c93 100644 --- a/R/plot-wis.R +++ b/R/plot-wis.R @@ -56,10 +56,11 @@ plot_wis <- function(scores, assert_logical(relative_contributions, len = 1) assert_logical(flip, len = 1) - scores <- melt(scores, - measure.vars = wis_components, - variable.name = "wis_component_name", - value.name = "component_value" + scores <- melt( + scores, + measure.vars = wis_components, + variable.name = "wis_component_name", + value.name = "component_value" ) # stack or fill the geom_col position