Re: [R] Subset results of tapply

2008-02-07 Thread Richard . Cotton
> I would like to extract only p.value by performing wilcox.test with > tapply function. > > tapply(tmp$pc, tmp$name, wilcox.test) > > How can I extract only p.values of above command? Try this: wilcoxp <- function(x, ...) { y <- wilcox.test(x, ...) y$p.value } tapply(tmp$pc, tmp$name

Re: [R] Subset results of tapply

2008-02-07 Thread Romain Francois
Hi, You can define your own function within tapply. Something like this should do the trick : > tapply(tmp$pc, tmp$name, function(x) wilcox.test(x)$p.value ) Cheers, Romain -- Mango Solutions data analysis that delivers Introduction to R training course :: London :: 06-07 March 2008 http://

[R] Subset results of tapply

2008-02-07 Thread Dong-hyun Oh
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 DttDt2t2 Dgt Dgt2ec tcpc 1AUS 1991 1.162935 1.141352 1.168011 1.193882 1.0189098 0.9601735 0.