Software
wdunlap tibco.com
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf
Of Michael Friendly
Sent: Thursday, January 09, 2014 7:14 AM
To: R-help
Subject: [R] recoding table dimensions interactively
Given a 3+ way table, I'd like
Hi Michael,
It's pretty easy with reshape:
library(reshape2)
ucbm <- melt(UCBAdmissions)
acast(ucbm, Admit + Gender ~ Dept)
acast(ucbm, Admit ~ Dept + Gender)
acast(ucbm, Admit + Dept + Gender ~ .)
# You can also do aggregations
acast(ucbm, Admit ~ Dept, fun = sum)
Hadley
On Thu, Jan 9, 2014 a
re, TIBCO Software
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf
> Of Michael Friendly
> Sent: Thursday, January 09, 2014 7:14 AM
> To: R-help
> Subject: [R] recoding table dimensions int
Given a 3+ way table, I'd like a simple, elegant way to flatten the
table to a two-way
table, with some variables joined interactively to form the rows and
others forming
the columns. For example, starting with
> str(UCBAdmissions)
table [1:2, 1:2, 1:6] 512 313 89 19 353 207 17 8 120 205 ...
4 matches
Mail list logo