Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #809 - Replace is.logical by isTRUE #815

Merged
merged 3 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions R/forecast.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion R/metrics-validate.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion R/pairwise-comparisons.R
Original file line number Diff line number Diff line change
Expand Up @@ -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}}"
Expand Down
2 changes: 1 addition & 1 deletion R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down