Skip to content

Commit

Permalink
check_single_logical <- check_bool
Browse files Browse the repository at this point in the history
  • Loading branch information
topepo committed Oct 21, 2024
1 parent cb3fc21 commit da13c05
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 482 deletions.
13 changes: 0 additions & 13 deletions R/checks.R
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
# Additional type checkers designed for testing argument values.

check_single_logical <- function(x, call = rlang::caller_env()) {
cl <- match.call()
arg_nm <- as.character(cl$x)
msg <- "{.arg {arg_nm}} should be a single logical value, not {obj_type_friendly(x)}."
if (!is.logical(x)) {
cli::cli_abort(msg, call = call)
}
if (length(x) > 1 || any(is.na(x))) {
cli::cli_abort(msg, call = call)
}
invisible(x)
}

check_number_whole_vec <- function(x, call = rlang::caller_env(), arg = rlang::caller_arg(x), ...) {

for (i in x) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,3 @@
# checking single logicals

Code
brulee:::check_single_logical(variable)
Condition
Error:
! `variable` should be a single logical value, not the string "pie".

---

Code
brulee:::check_single_logical(variable)
Condition
Error:
! `variable` should be a single logical value, not `NA`.

---

Code
brulee:::check_single_logical(variable)
Condition
Error:
! `variable` should be a single logical value, not a logical vector.

# checking double vectors

Code
Expand Down
Loading

0 comments on commit da13c05

Please sign in to comment.