0

https://i.stack.imgur.com/MFQtM.png

Hi. The question of this problem is "Does the shell length (in mm) of fossil brachiopods differ among three types of carbonate rock (mudstone, packstone, and grainstone)? Report the results of the Kruskal-Wallis test": (with a data file of https://people.ucsc.edu/~mclapham/eart125/data/brachsize.csv)

Enter the H value below.

I'm just wondering how should I approach as I kept receiving Error? Or where did I do wrong for the coding because I'm stuck? I would like some guidance or explanations on how should I set up. Thank you.

  • 1
    based on this question and your last, it would be very helpful if you would review [this](https://stackoverflow.com/help/how-to-ask) and [this](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) for your next question – rawr Jan 23 '22 at 01:48
  • Please provide enough code so others can better understand or reproduce the problem. – Community Jan 30 '22 at 11:01

1 Answers1

0

You have to make sure to pass every group level of lithology to kruskal.test().

test <- kruskal.test(branchsize$lithology ~ branchsize$size)
#test <- kruskal.test(lithology ~ size, data = branchsize) # equivalently
#test <- with(branchsize, kruskal.test(lithology ~ size)) # equivalently
# -----------------------------------------------------------------------
> test$statistic
Kruskal-Wallis chi-squared 
                  105.3318 # H value
Dion Groothof
  • 1,406
  • 5
  • 15