I'm using kruskal.test
in R. The problem I'm having is that I wanted to find p-values for each categorical variable (ie. gender, separated by female and male).
If I have data:
Type month ethnicity length age sex
A 1 White 20 35 F
B 3 White 35 45 F
A 2 Hispanic 40 50 M
B 2 Hispanic 43 33 M
Something like this, and if I want to calculate p-values for the each ethnicity type by Type, what should I do?
Right now the code is:
kruskal.test(length~ Type, data=df)
but I can't do
kruskal.test(sex$M~ Type, data=df)
The data is not normally distributed. I appreciate any suggestions