"Dupouey Jean-Luc" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]:
On my system wilcox.test() exists, whereas wilcox_test() did not. Help.search("wilcox_test") does not produce any clues. If you are using a test from another package, you should specify which package the test comes from. Web searching produces links to package coin. Have you tried? wtest <- by(mydata, mydata$myindice, function (x) { wilcox_test(value~fact, data=x)}) ----slight modification to the wilcox_test example data------ > mydata pd age grp 1 0.80 At term 1 2 0.83 At term 2 3 1.89 At term 1 4 1.04 At term 2 5 1.45 At term 1 6 1.38 At term 2 7 1.91 At term 1 8 1.64 At term 2 9 0.73 At term 1 10 1.46 At term 2 11 1.15 12-26 Weeks 1 12 0.88 12-26 Weeks 2 13 0.90 12-26 Weeks 1 14 0.74 12-26 Weeks 2 15 1.21 12-26 Weeks 1 16 1.10 12-26 Weeks 2 > wilcoxtest <- by(mydata, mydata$grp, function(x) + {wilcox_test(pd~age, data=x)} + ) > wilcoxtest Asymptotic Wilcoxon Mann-Whitney Rank Sum Test data: pd by age (12-26 Weeks, At term) Z = -0.4472, p-value = 0.6547 alternative hypothesis: true mu is not equal to 0 --------------------------------------------------- Asymptotic Wilcoxon Mann-Whitney Rank Sum Test data: pd by age (12-26 Weeks, At term) Z = -1.3416, p-value = 0.1797 alternative hypothesis: true mu is not equal to 0 -- David Winsemius > I want to apply a Wilcoxon test on subsets of the data frame mydata, > splitted using the myindice variable. When I send : > > wilcoxtest <- by(mydata, mydata$myindice, function(x) > {wilcox_test(x$value~x$fact)}) > > I get : > > Error in eval(expr, envir, enclos) : object "x" not found > > whereas > > wilcoxtest <- by(mydata, mydata$myindice, function(x) > {wilcox.test(x$value~x$fact)}) > works ! > Why does it fail with the wilcox_test only? And, most important, how > can I apply the wilcox_test function to subsets of mydata splitted > according to mydata$myindice ? > ______________________________________________ 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.