Re: [R] tapply

From: Bojanowski, M.J. (Michal) <M.J.Bojanowski_at_uu.nl>
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 )

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_at_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. 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 https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.