diff --git a/R/forecast.R b/R/forecast.R index 9903e634..f0bc738c 100644 --- a/R/forecast.R +++ b/R/forecast.R @@ -140,7 +140,7 @@ as_forecast.default <- function(data, #old binary format if (forecast_type == "point") { looks_binary <- check_input_binary(factor(data$observed), data$predicted) - if (is.logical(looks_binary)) { + if (isTRUE(looks_binary)) { #nolint start: keyword_quote_linter duplicate_argument_linter cli_warn( c( @@ -233,7 +233,7 @@ assert_forecast.forecast_binary <- function( ) } input_check <- check_input_binary(forecast$observed, forecast$predicted) - if (!is.logical(input_check)) { + if (!isTRUE(input_check)) { cli_abort( c( "!" = "Checking `forecast`: Input looks like a binary forecast, but @@ -256,7 +256,7 @@ assert_forecast.forecast_point <- function( assert_forecast_type(forecast, actual = "point", desired = forecast_type) #nolint start: keyword_quote_linter object_usage_linter input_check <- check_input_point(forecast$observed, forecast$predicted) - if (!is.logical(input_check)) { + if (!isTRUE(input_check)) { cli_abort( c( "!" = "Checking `forecast`: Input looks like a point forecast, but found @@ -349,7 +349,7 @@ assert_forecast_generic <- function(data, verbose = TRUE) { # check that the number of forecasts per sample / quantile level is the same number_quantiles_samples <- check_number_per_forecast(data, forecast_unit) - if (!is.logical(number_quantiles_samples) && verbose) { + if (!isTRUE(number_quantiles_samples) && verbose) { cli_warn(number_quantiles_samples) } diff --git a/R/metrics-validate.R b/R/metrics-validate.R index 51a44769..a26eb25f 100644 --- a/R/metrics-validate.R +++ b/R/metrics-validate.R @@ -22,7 +22,7 @@ validate_metrics <- function(metrics) { for (i in seq_along(metrics)) { check_fun <- check_function(metrics[[i]]) - if (!is.logical(check_fun)) { + if (!isTRUE(check_fun)) { #nolint start: keyword_quote_linter cli_warn( c( diff --git a/R/pairwise-comparisons.R b/R/pairwise-comparisons.R index c035e70b..04762a79 100644 --- a/R/pairwise-comparisons.R +++ b/R/pairwise-comparisons.R @@ -128,7 +128,7 @@ get_pairwise_comparisons <- function( # check that model column + columns in 'by' are present #nolint start: keyword_quote_linter object_usage_linter by_cols <- check_columns_present(scores, by) - if (!is.logical(by_cols)) { + if (!isTRUE(by_cols)) { cli_abort( c( "!" = "Not all columns specified in `by` are present: {.var {by_cols}}" diff --git a/R/plot.R b/R/plot.R index cecbcebb..1b3abbb0 100644 --- a/R/plot.R +++ b/R/plot.R @@ -659,7 +659,7 @@ plot_correlations <- function(correlations) { # check correlations is actually a matrix of correlations col_present <- check_columns_present(correlations, "metric") - if (any(lower_triangle > 1, na.rm = TRUE) || !is.logical(col_present)) { + if (any(lower_triangle > 1, na.rm = TRUE) || !isTRUE(col_present)) { #nolint start: keyword_quote_linter cli_abort( c( diff --git a/README.md b/README.md index 2e30b9d9..1e0bbe8e 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,9 @@ forecast_quantile <- example_quantile |> ) #> ℹ Some rows containing NA values may be removed. This is fine if not #> unexpected. +``` + +``` r print(forecast_quantile, 2) #> Forecast type: quantile