[R] How to apply the Wilcoxon test to a hole table at once?

Iurie Malai iurie.malai at gmail.com
Sat Oct 24 07:23:15 CEST 2009


Thank you!

Here is my adapted script:

>lapply(Dataset[3:17], function(x) wilcox.test(x ~ X2,
alternative="two.sided", data=Dataset, subset = X2 <= 2))

but in R I have nothing, and in R Commander I have this error message:

ERROR: grouping factor must have exactly 2 levels

My grouping factor is in X2 column and there are only two levels (m and f).
Where is the problem?

Iu. Malai


Iurie Malai wrote:
> 
> Hi,
> 
> I have a data set:
> 
>> Dataset
>         X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17
> 1 user1  m 22 19 28 24 12 18  9   7   4   5   4   7   5   7   9
> 2 user2  f 25 19 23 18 18 15  6   8   6   6   7  10   7   7   7
> 3 user3  f 28 21 24 18 15 12 10   6   7   9   5  10   5   9   5
> 4 user4  f 26 19 26 21 12 18  6   6   5   1   3   8   6   5   6
> 5 user5  m 21 22 26 18  9  6  4   6   1   7   2   4   4   6   4
> 6 user6  m 24  8 25 12 18 12  7   8   4   1   4   6   7   5   6
> ...............................................................
> 71 user71  m 18  4 10  6  3  6  9   5  10   8   4   5   6   5   5
> 
> I can apply the Wilcoxon test on each column one by one, but how to do
> this on the hole table at once?
> 
>> wilcox.test(X3 ~ X2, alternative="two.sided", data=Dataset)
> 
> 	Wilcoxon rank sum test with continuity correction
> 
> data:  X3 by X2 
> W = 439, p-value = 0.1291
> alternative hypothesis: true location shift is not equal to 0 
> 
>>
> 
> I researched on this, but I can't find a solution.
> I would really appreciate any help. 
> 
> P.S. Excuse my lack of terminology :).
> 
> Iurie Malai
> Moldova Pedagogical State University
> 

-- 
View this message in context: http://www.nabble.com/How-to-apply-the-Wilcoxon-test-to-a-hole-table-at-once--tp26030572p26036261.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list