Skip to content

Commit

Permalink
eaano: matrix function can return a simple vector or data.frame
Browse files Browse the repository at this point in the history
  • Loading branch information
Yunuuuu committed Jun 26, 2024
1 parent 0172cd4 commit 029f973
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions R/eanno.R
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,15 @@ methods::setMethod(
row = heat_matrix,
column = t(heat_matrix)
)
if (!is.matrix(mat <- mat(data))) {
cli::cli_abort("{.fn @matrix} of {id} must return a matrix")
}
mat <- tryCatch(
build_matrix(mat(data)),
function(cnd) {
cli::cli_abort(paste(
"{.fn @matrix} of {id} must return a {.cls matrix},",
"a simple vector, or a {.cls data.frame}."
))
}
)
object@n <- nrow(mat)
}
object@matrix <- mat
Expand Down

0 comments on commit 029f973

Please sign in to comment.