'R loop for Kruskal-wallis test with confounders?

I have a large dataframe 2000 subjects (into 3 groups) x 80 observations . I have multiple questions.

  1. They are not normally distributed. Do I check normality for each observation group-wise or whole data?
  2. I need to perform kruskal-wallis/anova for all 80 observations between these groups. I found a code:
    R: Kruskal-Wallis test in loop over specified columns in data frame

but this doesn't account for confounders. Is there a way to add it in the formula?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source