Skip to content

Commit

Permalink
Error handling/messaging update
Browse files Browse the repository at this point in the history
  • Loading branch information
ddsjoberg committed Oct 9, 2024
1 parent c1b7f26 commit b622a58
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion R/tbl_cross.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ tbl_cross <- function(data,

# check inputs ---------------------------------------------------------------
check_not_missing(data)
if (!missing(row) + !missing(col) == 1L) {
if (sum(!missing(row), !missing(col)) == 1L) {
cli::cli_abort(
"Specify both {.arg row} and {.arg col} arguments or neither.",
call = get_cli_abort_call()
Expand Down
4 changes: 1 addition & 3 deletions tests/testthat/_snaps/tbl_cross.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@
tbl_cross(trial, col = trt)
Condition
Error in `tbl_cross()`:
! Error processing `type` argument.
! i In argument: `all_of(row)`. Caused by error in `all_of()`: ! Can't subset elements that don't exist. x Element `trt` doesn't exist.
i Select among columns "..total.."
! Specify both `row` and `col` arguments or neither.

---

Expand Down

0 comments on commit b622a58

Please sign in to comment.