Re: [R] Aggregate and cross tabulation

2009-10-27 Thread jim holtman
FIRST: PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. If you expect an answer, please provide the data. Here is one way of doing it: > N <- 30 > x <- data.frame(A=sample(1:3, N, TRUE), B=sample(1:2,

[R] Aggregate and cross tabulation

2009-10-27 Thread Jonathan Greenberg
R-helpers: I have a data frame containing 4 factor variables (let's say A,B,C, and D) and 1 numerical variable (N). I would like to produce a cross-tabulated data frame in which A,B,C are individual columns, each factor of D is its own column, and the field is calculated as a given functi