Re: [R] tapply

From: Bojanowski, M.J. (Michal) <>
Date: Fri, 01 Jun 2007 13:27:46 +0200

I'm not sure what is the 'pvalue' function (it's not found in base nor stats packages) but
this should give you what you want:

# some example
re <- rnorm(100)
reg <- rep(1:3, length=100)
ast <- rep(1:2, length=100)

tapply( re, list(reg, ast), function(v) shapiro.test(v)$p.value )

# or neater by defining a function
p.shapiro <- function(v) shapiro.test(v)$p.value tapply( re, list(reg, ast), p.shapiro )



> Hello, I want to conduct normality test to a series of data
> and get the
> p-value for each subset. I am using the following codes, but
> it does not
> work.
> tapply(re, list(reg, ast), pvalue(shapiro.test))
> Could anyone give me some advice? Many thanks. mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Fri 01 Jun 2007 - 11:52:16 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 01 Jun 2007 - 12:31:33 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.