[R] Kruskal.test

arun smartpink111 at yahoo.com
Fri Jul 19 19:43:16 CEST 2013


Hi,
You could try:
Chisq1<-do.call(cbind,lapply(c(0.05,0.001),function(i) {x1<-sapply(seq_len(nrow(Specc)),function(i) chisq.test(as.table(unlist(Specc[i,-c(1:3)])))$p.value); sum(x1<i)}))
 Wilcox1<-do.call(cbind,lapply(c(0.05,0.001),function(i){x1<-sapply(seq_len(nrow(Specc)),function(i) wilcox.test(unlist(Specc[i,-c(1:3)]))$p.value);sum(x1<i)}))

res<-rbind(Wilcox1,Chisq1)
 colnames(res)<- c("number of rows iwth p-value<0.05", "number of rows with p-value<0.001")
 rownames(res)<-c("wilcox.test","chisq.test")
  res
#            number of rows iwth p-value<0.05 number of rows with p-value<0.001
#wilcox.test                               14                                 0
#chisq.test                                 0                                 0


#The warnings() were there for all the rows.
#If you want, you could have a new column with "name of test", instead of rownames.

A.K.





________________________________
From: Vera Costa <veracosta.rt at gmail.com>
To: arun <smartpink111 at yahoo.com> 
Sent: Friday, July 19, 2013 1:25 PM
Subject: Re: Kruskal.test



Thank you. 
But I need to construct a dataframe like I sent you. You can help me in this? I will look for your code in a few moments
No dia 19 de Jul de 2013 18:20, "arun" <smartpink111 at yahoo.com> escreveu:



More information about the R-help mailing list