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.

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
  • Re: [R] tapply Bojanowski, M.J. \(Michal\)

Reply via email to