I am having trouble with coding a Kruskal-Wallis test in R. I tried to find how does it work but could not find any answers. I have a dataset with 89 columns and I have to compare each column with a group of others.
For example, I have the data of various extensometers and other instruments at those 89 columns, but I need to compare the extensometers with each other. Since Kruskal-Wallis is a test for three or more groups, can I do that with my dataset, should I vectorize it, make a list or do I have to compare it 1 by 1?
I am trying to make this loop for the 1 by 1 way:
i=3
j=3
while(i <= 8){
if(j==i)
j=j+1
else
l1<- paste0("X__", i)
l2<- paste0("X__", j)
L1 <- as.factor(l1)
L2 <- as.factor(l2)
kruskal.test(L1~L2, data = dados)
i = i+1
}
And getting the error that all observations are in the same group.