Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed May 11, 2024
1 parent 0b7853c commit 8f966fc
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions R/mann_whitney_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ mann_whitney_test <- function(data,

# does select indicate more than one variable?
if (length(select) > 1) {
if (!is.null(by)) {
insight::format_error("If `select` specifies more than one variable, `by` must be `NULL`.")
}
# we convert the data into long format, and create a grouping variable
data <- datawizard::data_to_long(data[select], names_to = "group", values_to = "scale")
by <- select[2]
Expand Down Expand Up @@ -276,7 +273,7 @@ mann_whitney_test <- function(data,
if (identical(test, "t_test") && length(select) > 2) {
insight::format_error("You may only specify two variables for Student's t test.")
}
if ((identical(test, "t_test") || identical(test, "kruskal_wallis_test")) && length(select) > 1 && !is.null(by)) {
if ((!is.null(test) && test %in% c("t_test", "kruskal_wallis_test", "mann_whitney_test")) && length(select) > 1 && !is.null(by)) { # nolint
insight::format_error("If `select` specifies more than one variable, `by` must be `NULL`.")
}

Expand Down

0 comments on commit 8f966fc

Please sign in to comment.