[R] tapply

Bojanowski, M.J. (Michal) M.J.Bojanowski at uu.nl
Fri Jun 1 13:27:46 CEST 2007


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 )



hth,

michal

> 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.



More information about the R-help mailing list