Skip to content

Commit

Permalink
use .coerce_to_dataframe()
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennebacher committed Aug 10, 2023
1 parent bd6d3d9 commit 2a98559
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions R/rowmean_n.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,7 @@
#'
#' @export
rowmean_n <- function(data, n, digits = NULL, verbose = TRUE) {
# check if data is data frame or matrix
if (!is.data.frame(data) && !is.matrix(data)) {
insight::format_error("`data` must be a data frame or matrix.")
}

# coerce matrix to data frame
if (is.matrix(data)) {
data <- .coerce_to_dataframe(data)
}
data <- .coerce_to_dataframe(data)

# n must be a numeric, non-missing value
if (is.null(n) || all(is.na(n)) || !is.numeric(n) || length(n) > 1) {
Expand Down

0 comments on commit 2a98559

Please sign in to comment.