Here is the problem with the iris dataframe. I´m trying to run a kruskal.test of each variable against the species.
library(dplyr)
for (col in colnames(iris)[1:ncol(iris)-1]) {
iris %>%
group_by(Species) %>%
summarise(
zone=col,
pvalue = kruskal.test(get(col) ~ Species)$p.value,
) %>%
print()
Error in (function (cond) :
error in evaluating the argument 'x' in selecting a method for function 'print': ℹ In argument: pvalue = kruskal.test(get(col) ~ Species)$p.value
.
ℹ In group 1: Species = setosa
.
Caused by error in kruskal.test.default()
:
! all observations are in the same group