[R] Aggregate drops empty subsets
Andrew Robinson
andrewr at uidaho.edu
Wed Apr 14 16:53:19 CEST 2004
Hi Sundar,
that's excellent - and a very educational answer.
Thanks very much!
Andrew
>
> Hi Andrew,
>
> How about:
>
> ui <- data.frame(burn = c("low", "high", "low", "low"),
> age = c("young", "old", "old", "young"),
> junk = c("a", "a", "b", "b"))
> ui2 <- do.call("table", ui)
> ui3 <- expand.grid(dimnames(ui2))
> ui3[paste(names(ui), collapse = ".")] <-
> do.call("paste", c(ui3, sep = "."))
> ui3$count <- c(ui2)
>
> I'm using R-1.9.0 on win2000.
>
> --sundar
>
>
--
Andrew Robinson Ph: 208 885 7115
Department of Forest Resources Fa: 208 885 6226
University of Idaho E : andrewr at uidaho.edu
PO Box 441133 W : http://www.uidaho.edu/~andrewr
Moscow ID 83843 Or: http://www.biometrics.uidaho.edu
No statement above necessarily represents my employer's opinion.
More information about the R-help
mailing list