[R] error in test

jim holtman jholtman at gmail.com
Sat Jul 26 07:08:38 CEST 2008


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?



More information about the R-help mailing list