In your data frame, women's weight comes first:
weight = c(women_weight, men_weight)
And you wrote:
Note that: if you want to test whether the average men’s weight is LESS than the average women’s weight, type this:
t.test(weight ~ group, data = my_data, var.equal = TRUE, alternative = "less")
You implied:
if you want to test whether the average women’s weight is GREATER than the average men’s weight, type this:
t.test(weight ~ group, data = my_data, var.equal = TRUE, alternative = "less")
But, let's see the documentation via ?t.test:
t.test(x, y.....)
alternative = "greater" is the alternative that x has a LARGER mean than y
Hence, you should change like this:
Note that: if you want to test whether the average men’s weight is LESS than the average women’s weight (i.e., the average women’s weight is GREATER than the average men’s weight), type this:
t.test(weight ~ group, data = my_data, var.equal = TRUE, alternative = "greater")
And similarly you should change for the womens' LESS case as well.
Comments