# Comparing two means – Mann-Whitney U test

The Mann-Whitney U test (also known as Wilcoxon rank-sum test) allows for comparison of two groups which do not necessarily originate from normal distributions. This means that you may use this test even if the samples have a normal distribution. This is thus a good alternative to Student’s t-test when the assumption of normality might constitute a problem.

The function to use in R is `wilcox.test(x, y)` where `x` and `y` are the vectors containing the samples. Let’s use the same example as we have use for Student’s t-test:

```W1.may15<-c(6.3,6.3,8.1,8.9,11.6,10.4,6.8)
W1.may16<-c(6.9,7.7,7.9,9.1,11.3,11.8,14.2)
wilcox.test(W1.may15,W1.may16)
```

So, the test results in a p-value greater than 0.05, thus indicating that the null hypothesis is not to be rejected. The sample means are not significantly different.