Skip to content

Commit

Permalink
lint for the lint god
Browse files Browse the repository at this point in the history
  • Loading branch information
nikosbosse committed Oct 6, 2024
1 parent 95ee27c commit c709b89
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 23 deletions.
2 changes: 1 addition & 1 deletion R/class-forecast-quantile.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 8 additions & 6 deletions R/get-coverage.R
Original file line number Diff line number Diff line change
Expand Up @@ -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() +
Expand Down Expand Up @@ -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() +
Expand Down
15 changes: 8 additions & 7 deletions R/get-pit-generic.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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"
)
}

Expand All @@ -172,4 +174,3 @@ plot_pit <- function(pit,

return(hist)
}

11 changes: 6 additions & 5 deletions R/pairwise-comparisons.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
}
Expand Down
9 changes: 5 additions & 4 deletions R/plot-wis.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c709b89

Please sign in to comment.