Re: [R] error in test

From: jim holtman <jholtman_at_gmail.com>
Date: Sat, 26 Jul 2008 01:08:38 -0400

Why do you declare a function 'wilcox.test' and then inside the function, call 'wilcox.test' again? The second 'recursive' call now has parameters that your function knows nothing about. I would advise you changing your function's name to something else.

On Sat, Jul 26, 2008 at 12:52 AM, Paul Adams <pma3622_at_yahoo.com> wrote:
> Hello everyone,
>
> I am trying to use the following code:
>
> dat<-read.table(file="C:\\Documents.....txt")
> class2<-read.table(file="C:\\Documents.....txt")
> class1<-read.table(file="C:\\Documents .....txt")
> dat<-as.data.frame(dat)
> dimnames(dat)[[1]]<-paste("g",c(1:nrow(dat)),sep="")
> l<-c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1)
> rbind(l,dat)
> dat<-as.matrix(dat)
> x<-dat[1:100,]
> wilcox.test<-function(x,s1,s2) {
> x1<-x[s1]
> x2<-x[s2]
> x1<-as.numeric(x1)
> x2<-as.numeric(x2)
> wilcox.out<-wilcox.test(x,y=NULL,exact=FALSE,mu=0,correct=TRUE,alternative="two.sided",paired=FALSE)
> out<-as.numeric(wilcox.out$statistic)
> return(out)
> }
> wilcox.test.run<-apply(x,1,wilcox.test,s1=x[1:27],s2=x[28:39])
> wilcox.test.run[is.na(wilcox.test.run)]<-1
>
> The error I get is that error in wilcox.test : unused arguments(y=Null,exact=FALSE,mu=0,correct=TRUE,alternative="two.sided,paired=FALSE)
> I get this error no matter if I use all the arguments available or as few arguments as possible.
> I do not know what I am doing wrong and would appreciate any suggestions.
> Thanks
> Paul
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_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.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

______________________________________________
R-help_at_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.
Received on Sat 26 Jul 2008 - 05:11:56 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 26 Jul 2008 - 05:32:39 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive