0
votes

I know that many have asked the exact same thing, but nothing solved it for me...

I want to compare the size of a morphological structure between two age groups (which I call BW and brownish), I'm sure I only have these two categories and there are no empty cells or NAs

But every time I try it appears that I have more than 2 levels

I can't use the levels function either, it returns null, str(dd1) returns male_color is a Character Datatype and the Right_tarsus is a number Datatype data, as the spected

the morphological data also worked well in the ggdensity and shapiro.test to test normality,

MU_test_color_tarsus <- wilcox.test(Right_tarsus ~ male_color, data = dd1, paired = F, conf.level = 0.95) 
wilcox.test(Right_tarsus ~ male_color, data = dd1, paired = F, conf.level = 0.95)
Without the data or even a sample of it, it is difficult to know what the problem is. What do table(dd1$Right_tarsus) and table(dd1$male_color) look like? It may be that there are some misspelled values in your data.dcarlson
The error doesn't say that you have more than 2 levels, just that 2 levels are required. If male_color is of type character then it has no levels - it needs to be of type factor. Perhaps try dd1$male_color <- as.factor(dd1$male_color) then run the test again ? But really we need to see your data by including a small representative dataset in a plain text format - for example the output from dput(dd1), if that is not too large.neilfws