[R] Subset results of tapply

Dong-hyun Oh r.arecibo at gmail.com
Thu Feb 7 13:13:33 CET 2008


Dear UseRs,

I would like to extract only p.value by performing wilcox.test with  
tapply function.

Example data.frame is as follows:
 > tmp
     name year      Dtt    Dt2t2      Dgt     Dgt2        ec         
tc        pc
1    AUS 1991 1.162935 1.141352 1.168011 1.193882 1.0189098 0.9601735  
0.9783301
2    AUS 1992 1.141352 1.000000 1.193882 1.181406 1.1413519 0.8854061  
1.0105599
3    AUS 1993 1.000000 1.000000 1.181406 1.198598 1.0000000 0.9856568  
0.9856568
4    AUS 1994 1.000000 1.000000 1.198598 1.187553 1.0000000 1.0093005  
1.0093005
5    AUS 1995 1.000000 1.000000 1.187553 1.207423 1.0000000 0.9835433  
0.9835433
.........................
15   AUT 1991 1.000000 1.000000 1.000000 1.023534 1.0000000 0.9770075  
0.9770075
16   AUT 1992 1.000000 1.000000 1.023534 1.000000 1.0000000 1.0235336  
1.0235336
17   AUT 1993 1.000000 1.000000 1.000000 1.012671 1.0000000 0.9874880  
0.9874880
18   AUT 1994 1.000000 1.000000 1.012671 1.010350 1.0000000 1.0022970  
1.0022970
19   AUT 1995 1.000000 1.000000 1.010350 1.029325 1.0000000 0.9815653  
0.9815653
20   AUT 1996 1.000000 1.000000 1.029325 1.053247 1.0000000 0.9772873  
0.9772873
.......................
.......................

I execute the following command
 > tapply(tmp$pc, tmp$name, wilcox.test)

How can I extract only p.values of above command?

Best,

=========================================================
Center of Excellence for Science and Innovation Studies,
Royal Institute of Technology, Sweden
e-mail: donghoh at infra.kth.se, doriaba2 at snu.ac.kr, oh.dongh at gmail.com
cell phone: +46 73 563 45 22



More information about the R-help mailing list