[R] Subset results of tapply

Richard.Cotton at hsl.gov.uk Richard.Cotton at hsl.gov.uk
Thu Feb 7 14:16:44 CET 2008


> 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, wilcoxp)

Regards,
Richie.

Mathematical Sciences Unit
HSL


------------------------------------------------------------------------
ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}



More information about the R-help mailing list