[R] Running wilcox.test function on two lists

Raj, Towfique
Thu, 07 Sep 2006 19:54:04 -0000

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.