HI,
May be this helps:
dat1<- read.table(text="
beforesmall aftersmall
63.5      512.0
54.5      237.5
52.5      161.5
78.0      153.5
53.5       68.0
50.5       65.5
69.0       52.0
76.0       59.0
68.0       66.5
75.5       66.5
67.0       45.5
81.0       54.5
49.0       44.0
51.0       42.5
53.0       34.5
",sep="",header=TRUE) 
wilcox.test(dat1$beforesmall,dat1$aftersmall,paired=T)
#
#    Wilcoxon signed rank test with continuity correction
#
#data:  dat1$beforesmall and dat1$aftersmall
#V = 55, p-value = 0.7982
#alternative hypothesis: true location shift is not equal to 0
#or
library(reshape2)
 dat2<-melt(dat1)
wilcox.test(value~variable,data=dat2,paired=TRUE)
##
#    Wilcoxon signed rank test with continuity correction
#
#data:  value by variable
#V = 55, p-value = 0.7982
#alternative hypothesis: true location shift is not equal to 0

A.K.


Hi, 
I've been trying to run a wilcox paired test on some data 
 beforesmall aftersmall 
 [1,]        63.5      512.0 
 [2,]        54.5      237.5 
 [3,]        52.5      161.5 
 [4,]        78.0      153.5 
 [5,]        53.5       68.0 
 [6,]        50.5       65.5 
 [7,]        69.0       52.0 
 [8,]        76.0       59.0 
 [9,]        68.0       66.5 
[10,]        75.5       66.5 
[11,]        67.0       45.5 
[12,]        81.0       54.5 
[13,]        49.0       44.0 
[14,]        51.0       42.5 
[15,]        53.0       34.5 

using 
wilcox.test(beforesmall ~ aftersmall,paired=T) 
but I get the error message: 

Error in wilcox.test.formula(beforesmall ~ aftersmall, paired = T) : 
  grouping factor must have exactly 2 levels 

I don't have any missing values, I have the same amount of data points for 
each group and I've looked everywhere trying to find the answer. 
Please can somebody tell me how to make it work 
thanks

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to