Skip to content

Commit

Permalink
Replace is.logical by isTRUE
Browse files Browse the repository at this point in the history
  • Loading branch information
nikosbosse committed May 19, 2024
1 parent 1166149 commit e62a20a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion R/check-input-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ check_columns_present <- function(data, columns) {
#' @keywords internal_input_check
test_columns_present <- function(data, columns) {
check <- check_columns_present(data, columns)
return(is.logical(check))
return(isTRUE(check))
}

#' Test whether column names are NOT present in a data.frame
Expand Down
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

0 comments on commit e62a20a

Please sign in to comment.