On 11-10-24 7:16 PM, Hadley Wickham wrote:
On Mon, Oct 24, 2011 at 5:39 AM, Duncan Murdoch
wrote:
Suppose I have data like this:
A<- sample(letters[1:3], 1000, replace=TRUE)
B<- sample(LETTERS[1:2], 1000, replace=TRUE)
x<- rnorm(1000)
I can get a table of means via
tapply(x, list(A, B), mea
On Mon, Oct 24, 2011 at 5:39 AM, Duncan Murdoch
wrote:
> Suppose I have data like this:
>
> A <- sample(letters[1:3], 1000, replace=TRUE)
> B <- sample(LETTERS[1:2], 1000, replace=TRUE)
> x <- rnorm(1000)
>
> I can get a table of means via
>
> tapply(x, list(A, B), mean)
>
> and I can add the marg
gt; Date: Sun, 23 Oct 2011 14:39:08 -0400
> From: murdoch.dun...@gmail.com
> To: R-help@r-project.org
> Subject: [R] Summary stats in table
>
> Suppose I have data like this:
>
> A <- sample(letters[1:3], 1000, replace=TRUE)
> B <- sample(LETTERS[1:2], 1000, replace=TRU
Suppose I have data like this:
A <- sample(letters[1:3], 1000, replace=TRUE)
B <- sample(LETTERS[1:2], 1000, replace=TRUE)
x <- rnorm(1000)
I can get a table of means via
tapply(x, list(A, B), mean)
and I can add the marginal means to this using cbind/rbind:
main <- tapply(x, list(A,B), mean)
4 matches
Mail list logo