[R] Running wilcox.test function on two lists

From: Raj, Towfique <trajnp_at_gmail.com>
Date: Thu 07 Sep 2006 - 19:54:04 GMT


Dear all,
I'm a newbie to R and I would really apperciate any help with the following:

I have two lists, l1 and l2:

l1:
$"A*0101"
[1] 0.076 0.109 0.155 0.077 0.09 0 0 0.073
[9] 0.33 0.0034 0.0053

$"A*0247"
[1] 0 0 0.5 .004 0 0 0

$"A*0248"
[1] 0 0 0.3 0 0.06

....

l2:

$"A*1101"
[1] 0.17 0.24 0.097 0.075 0.067

$"A*0247"
numeric(0)

$"A*0248"
[1] 0.031

....

Basically, what I want to do is run wilcox.test() on each entry pair in the list.

  1. I want to loop through the list to run wilcox.test for each entry of the list. How would I do that? mapply()?

          wilcox.test(l0[[1]],l1[[1]]) for the first one and so on....

2) I want to exclude the list entry which has no values (i.e. A*0247).

3) Finally, I only want the to see the 'p-value' for each list names. The output I want capture is only the 'p-value' object from wilcox.test.

        name    p-value
       A*0101  0.8329
        ....       ....

I'm grateful for any help, or any pointers to a good online tutorial.

Thanks a lot in advance,

-T.



R-help@stat.math.ethz.ch 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 Fri Sep 08 05:59:08 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 07 Sep 2006 - 21:48:22 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.