omit empty cells in crosstab?
On Fri, Apr 24, 2009 at 3:12 PM, sjaffe <sjaffe at riskspan.com> wrote:
small example: a<-c(1.1, 2.1, 9.1) b<-cut(a,0:10) c<-data.frame(b,b) d<-table(c) dim(d) ##result: c(10, 10) But only 9 of the 100 cells are non-zero. If there were 10 columns, the table have 10 dimensions each of length 10, so have 10^10 elements, too much even to fit in memory
Here's one way with the plyr package: library(plyr) ddply(c, names(c), nrow) Find more about plyr at http://had.co.nz/plyr Hadley