Hi!
I searched some time ago a way to get the Wilcoxon test results as a table
more or less formatted. Nobody told me any solution and I found nothing on
the Internet. Recently I came across this link (
http://myowelt.blogspot.com/2008/04/beautiful-correlation-tables-in-r.html),
which helped me to find a solution.
Here's the solution (I'm using R Commander):
W <- as.matrix(lapply(Dataset[2:11], function(x) wilcox.test(x ~ GrFac,
alternative="two.sided", data=Dataset)$statistic))
P <- as.matrix(lapply(Dataset[2:11], function(x) wilcox.test(x ~ GrFac,
alternative="two.sided", data=Dataset)$p.value))
W <- format(W, digits = 5, nsmall = 2)
P <- format(P, digits = 1, nsmall = 3)
Wnew <- matrix(paste(W), ncol=ncol(Dataset[2:11]))
colnames(Wnew) <- paste(colnames(Dataset[2:11]))
Wnew
P
This is the output (excerpt):> Wnew
X1 X2 X3 X4 X5 X6 X7
X8 IA IV
[1,] "4582.50" "4335.50" "4610.50"
"4008.50" "6409.50" "6064.50" "5126.50"
"6861.50" "4305.50"
"5769.00"> P
[1] "0.301" "0.100" "0.336" "0.013"
"5e-04" "0.008" "0.756" "4e-06"
"0.089"
"0.059"
Can anyone share their views? Propose an improvement? For example, how to
make it appear as a table, not as separate rows? How to remove quotes? How
to show rows names W and P?
Regards,
Iurie Malai, Senior Lecturer
Department of Psychology
Faculty of Psychology and Special Education
Ion Creanga Moldova Pedagogical State University - www.upsm.md
http://en.wikipedia.org/wiki/Ion_Creang%C4%83_Pedagogical_State_University
-------------- next part --------------
"GrFac","X1","X2","X3","X4","X5","X6","X7","X8","IA","IV"
"town",7,5,4,5,5,8,6,8,5.30,7.00
"town",3,5,5,3,2,6,9,5,4.30,7.50
"town",7,5,8,0,3,10,9,5,6.60,9.50
"town",5,6,7,3,6,6,8,5,6.00,7.00
"town",6,7,7,5,5,7,8,8,6.60,7.50
"town",4,7,3,5,3,8,8,5,4.60,8.00
"town",5,5,7,4,5,10,8,8,5.60,9.00
"town",8,5,8,4,5,8,9,5,7.00,8.50
"town",9,7,8,4,5,5,8,3,8.00,6.50
"town",6,4,3,2,4,7,4,8,4.30,5.50
"town",3,5,4,2,6,5,9,7,4.00,7.00
"town",6,6,4,2,4,5,3,8,5.30,4.00
"town",6,6,8,4,6,8,9,7,6.60,8.50
"town",7,8,6,2,4,5,5,6,7.00,5.00
"town",2,6,5,4,6,10,7,9,4.30,8.50
"town",4,3,3,0,3,9,4,7,3.30,6.50
"town",7,6,5,3,3,6,8,4,6.00,7.00
"town",7,6,5,3,6,9,8,7,6.00,8.50
"town",7,5,9,4,4,5,3,4,7.00,4.00
"town",4,4,5,4,4,2,6,7,4.30,4.00
"town",5,3,8,2,4,10,11,7,5.30,10.50
"town",4,5,2,1,3,7,5,5,3.60,6.00
"town",5,6,7,2,5,7,5,7,6.00,6.00
"town",8,3,7,4,8,8,6,7,6.00,7.00
"town",4,2,2,4,2,4,6,6,2.60,5.00
"town",6,6,6,2,5,5,9,8,6.00,7.00
"town",6,6,8,3,7,8,10,6,6.60,9.00
"town",6,4,8,4,5,6,8,8,6.00,7.00
"town",2,2,4,3,3,5,6,2,2.60,5.50
"town",2,4,6,2,3,5,7,7,4.00,6.00
"town",2,4,2,2,2,5,5,7,2.60,5.00
"town",8,5,9,3,2,8,10,2,7.30,9.00
"town",7,6,5,3,3,8,9,4,6.00,8.50
"town",8,8,8,4,7,8,6,8,8.00,7.00
"town",4,3,8,5,7,5,8,3,5.00,6.50
"town",8,8,9,5,6,10,11,8,8.30,10.50
"town",3,3,4,0,1,5,5,4,3.30,5.00
"town",3,4,4,2,4,8,7,5,3.60,7.50
"town",5,5,5,5,4,7,5,2,5.00,6.00
"town",6,7,6,3,5,8,8,8,6.30,8.00
"town",5,3,5,4,5,7,4,8,4.30,5.50
"town",2,2,1,3,2,2,1,3,1.60,1.50
"town",5,6,7,1,5,6,3,4,6.00,4.50
"town",7,3,3,2,4,1,1,4,4.30,1.00
"town",6,1,8,1,6,6,7,5,5.00,6.50
"town",7,5,6,2,7,5,7,4,6.00,6.00
"town",4,6,9,2,4,4,6,5,6.30,5.00
"town",7,5,2,4,4,6,6,7,4.60,6.00
"town",5,3,8,3,5,5,4,2,5.30,4.50
"town",5,4,7,5,4,3,6,1,5.30,4.50
"town",5,6,4,1,6,8,9,7,5.00,8.50
"town",8,7,3,4,7,6,7,8,6.00,6.50
"town",7,4,4,5,4,6,7,4,5.00,6.50
"town",5,5,2,3,4,6,5,6,4.00,5.50
"town",4,1,3,2,2,6,4,8,2.60,5.00
"town",10,6,7,3,7,6,7,8,7.60,6.50
"town",6,3,3,3,4,8,8,4,4.00,8.00
"town",2,6,9,5,6,3,4,8,5.60,3.50
"town",8,4,5,2,4,6,9,4,5.60,7.50
"town",7,3,6,2,4,5,8,5,5.30,6.50
"town",7,5,6,4,4,5,6,1,6.00,5.50
"town",5,2,8,3,6,7,10,8,5.00,8.50
"town",4,5,4,3,5,8,8,7,4.30,8.00
"town",2,2,4,1,6,7,8,8,2.60,7.50
"town",4,4,7,5,2,6,6,6,5.00,6.00
"town",9,8,10,2,7,7,7,8,9.00,7.00
"town",5,6,4,4,2,8,5,5,5.00,6.50
"town",5,5,5,3,1,7,7,6,5.00,7.00
"town",7,3,5,4,6,9,8,7,5.00,8.50
"town",6,5,1,3,5,1,7,9,4.00,4.00
"town",5,5,5,2,1,7,6,6,5.00,6.50
"town",7,2,5,4,5,6,8,6,4.60,7.00
"town",8,8,7,5,4,7,11,6,7.60,9.00
"town",6,5,5,3,1,6,9,5,5.30,7.50
"town",5,6,6,5,4,4,8,2,5.60,6.00
"town",7,5,9,5,7,5,6,9,7.00,5.50
"town",5,7,3,2,3,7,8,8,5.00,7.50
"town",8,8,7,4,7,10,9,8,7.60,9.50
"town",9,6,7,5,7,7,9,6,7.30,8.00
"town",5,4,5,4,4,7,8,8,4.60,7.50
"town",6,3,5,5,7,5,5,5,4.60,5.00
"town",7,6,5,4,3,7,7,4,6.00,7.00
"town",8,6,6,5,1,3,7,7,6.60,5.00
"town",3,3,6,1,6,7,10,8,4.00,8.50
"town",6,4,8,2,5,7,7,6,6.00,7.00
"town",7,8,4,2,7,5,8,4,6.30,6.50
"town",8,7,7,5,7,8,7,9,7.30,7.50
"town",5,4,3,1,4,8,10,6,4.00,9.00
"town",4,4,2,4,4,5,6,5,3.30,5.50
"town",8,5,10,3,7,8,9,8,7.60,8.50
"town",6,1,2,4,3,3,4,5,3.00,3.50
"town",7,5,7,5,2,6,10,6,6.30,8.00
"town",3,5,4,1,3,6,6,5,4.00,6.00
"town",6,5,7,2,6,8,9,5,6.00,8.50
"town",6,5,7,2,4,6,7,7,6.00,6.50
"town",7,4,7,2,6,2,5,5,6.00,3.50
"town",8,3,7,4,4,5,7,7,6.00,6.00
"town",4,8,5,5,4,6,6,5,5.60,6.00
"town",9,8,10,4,8,9,10,7,9.00,9.50
"town",7,6,7,5,6,5,7,5,6.60,6.00
"country",6,8,6,4,7,8,8,9,6.60,8.00
"country",4,5,7,3,4,7,8,8,5.30,7.50
"country",7,5,7,3,6,7,9,4,6.30,8.00
"country",8,6,5,4,5,7,12,8,6.30,9.50
"country",2,4,3,3,4,6,6,9,3.00,6.00
"country",5,8,6,4,8,9,8,9,6.30,8.50
"country",7,6,9,4,7,9,10,7,7.30,9.50
"country",6,4,4,1,6,7,4,7,4.60,5.50
"country",5,3,1,2,8,4,5,7,3.00,4.50
"country",6,6,9,1,3,6,9,4,7.00,7.50
"country",6,3,7,4,7,10,10,9,5.30,10.00
"country",3,4,7,3,6,8,10,7,4.60,9.00
"country",6,3,3,4,6,7,11,8,4.00,9.00
"country",7,5,5,4,6,6,9,6,5.60,7.50
"country",7,4,4,1,6,8,7,6,5.00,7.50
"country",8,4,6,3,5,7,7,7,6.00,7.00
"country",7,4,4,1,4,9,9,6,5.00,9.00
"country",7,4,7,4,5,6,5,7,6.00,5.50
"country",6,3,7,5,7,6,5,9,5.30,5.50
"country",7,6,6,5,5,7,8,6,6.30,7.50
"country",5,1,6,1,6,7,2,7,4.00,4.50
"country",4,5,6,4,6,6,5,7,5.00,5.50
"country",3,3,5,2,4,6,6,5,3.60,6.00
"country",8,5,5,1,6,9,8,5,6.00,8.50
"country",4,3,4,1,1,4,7,6,3.60,5.50
"country",5,5,6,1,7,5,8,9,5.30,6.50
"country",6,5,3,3,7,7,8,7,4.60,7.50
"country",5,6,8,1,5,7,5,9,6.30,6.00
"country",3,8,5,4,7,4,6,7,5.30,5.00
"country",8,7,8,4,7,10,11,9,7.60,10.50
"country",5,3,3,4,4,7,9,5,3.60,8.00
"country",3,5,4,1,4,7,7,8,4.00,7.00
"country",7,1,6,2,3,6,4,6,4.60,5.00
"country",7,5,7,3,3,7,8,6,4.60,7.50
"country",3,2,6,1,4,11,4,5,3.60,7.50
"country",6,2,6,1,5,7,6,7,4.60,6.50
"country",4,4,4,0,5,10,6,5,4.00,8.00
"country",6,6,9,2,3,6,9,4,7.00,7.50
"country",3,2,4,3,7,9,9,5,3.00,9.00
"country",4,7,5,4,7,5,9,8,5.30,7.00
"country",6,5,6,4,5,8,9,7,5.60,8.50
"country",7,7,4,3,4,7,6,6,4.60,6.50
"country",6,4,5,2,4,6,6,9,5.00,6.00
"country",5,5,6,4,5,8,7,9,5.30,7.50
"country",9,3,4,2,6,9,7,8,5.30,8.00
"country",6,7,4,4,3,7,7,6,5.60,7.00
"country",7,4,7,2,8,7,7,9,6.00,7.00
"country",7,3,3,1,5,8,8,8,4.30,8.00
"country",2,6,5,4,7,10,8,9,4.30,9.00
"country",6,5,6,3,7,8,5,8,5.60,6.50
"country",3,4,1,0,5,6,5,9,2.60,5.50
"country",6,7,7,3,7,7,10,7,6.60,8.50
"country",2,2,3,3,3,6,4,5,2.30,5.00
"country",5,4,4,2,5,7,7,7,4.30,7.00
"country",7,4,4,2,5,6,8,7,5.00,7.00
"country",3,6,5,1,7,5,7,7,4.60,7.00
"country",6,3,3,4,6,6,7,8,4.00,7.50
"country",6,3,6,4,6,7,6,9,5.00,6.50
"country",6,7,5,2,5,7,9,7,6.00,8.00
"country",7,6,8,3,7,9,9,7,7.00,9.00
"country",7,4,5,2,7,6,5,7,5.30,5.50
"country",8,6,6,4,3,9,8,7,6.60,8.50
"country",6,4,4,4,3,4,6,6,4.60,5.00
"country",6,4,6,4,4,8,6,9,5.30,7.00
"country",5,9,7,5,7,7,10,9,7.00,8.50
"country",7,7,5,4,1,3,5,4,6.30,4.00
"country",6,2,5,3,1,6,7,5,4.30,6.50
"country",4,3,7,2,6,7,3,8,4.60,5.00
"country",6,6,7,1,7,8,8,6,6.30,8.00
"country",8,7,7,4,7,10,10,9,7.30,10.00
"country",5,3,5,1,6,7,10,5,4.30,8.50
"country",5,4,6,0,7,5,7,7,5.00,6.00
"country",5,2,4,2,4,10,5,8,3.60,7.50
"country",5,6,6,4,7,9,11,9,4.30,6.50
"country",4,5,7,4,6,8,7,9,5.60,10.00
"country",6,6,5,3,7,7,8,8,5.30,7.50
"country",3,3,1,2,5,9,5,9,5.60,8.00
"country",3,3,7,2,7,6,7,9,2.30,7.00
"country",4,7,6,2,4,5,6,8,5.60,5.50
"country",6,4,5,4,5,7,6,6,5.00,6.50
"country",6,7,5,2,7,6,5,8,6.00,5.50
"country",5,4,3,3,5,6,5,7,4.00,5.50
"country",6,6,8,3,6,8,8,9,6.60,8.00
"country",2,4,6,3,7,9,9,9,4.00,9.00
"country",9,4,10,3,5,7,8,9,7.60,7.50
"country",8,5,6,4,5,9,10,9,6.30,9.50
"country",3,5,8,2,7,6,10,8,5.30,8.00
"country",4,3,4,2,8,7,6,5,3.60,6.50
"country",6,5,6,3,3,7,8,7,5.60,7.50
"country",2,5,6,3,6,10,9,9,4.30,9.50
"country",3,3,5,1,6,6,8,8,3.60,7.00
"country",6,3,3,1,5,4,4,4,4.00,4.00
"country",6,5,2,4,3,7,6,8,4.30,6.50
"country",3,2,5,3,3,4,4,5,3.30,4.00
"country",6,2,3,1,5,6,5,6,3.60,5.50
"country",6,4,4,1,6,8,6,8,4.60,7.00
"country",6,2,9,5,6,7,7,7,5.60,7.00
"country",4,4,5,1,6,5,6,9,4.30,5.50
"country",8,6,7,4,6,7,6,5,7.00,6.50
"country",8,3,5,3,3,8,8,7,5.30,8.00