Hi,

I am trying to do a kruskal wallis test on two lists, fVisited and cSN:

fVisited[[1]]
[1] 0.17097623 0.30376141 0.17577266 0.14951855 0.03959753 0.08096217 
0.05744888 0.02196257....
....

cSN[[1]]
[1] 0.08557303 0.36477791 0.19601252 0.12981040 0.05351320 0.10385542 
0.03539577 0.03106175....


So if I just want to do a test on just one of the entries this is simple enough:

kruskal.test(fVisited[[1]],cSN[[1]])

        Kruskal-Wallis rank sum test

data:  fVisited[[1]] and cSN[[1]] 
Kruskal-Wallis chi-squared = 7, df = 7, p-value = 0.4289

However, if I try to do it over the entire list I get a problem.  I wanted to 
do a test comparing each pair of distributions, so I thought something such as: 
 
kT<-sapply(fVisited,function(.df){sapply(cSN,functions(.vecs){kruskal.test(.df,.vecs)})}
But that produces this:

Error in kruskal.test.default(.df, .vecs) : 
  'x' and 'g' must have the same length


However, the values do have the same length. Can anyone see what I am doing 
wrong here?

Thanks again for everyone's help.

______________________________________________
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