On 10/3/07, Farrel Buchinsky <[EMAIL PROTECTED]> wrote:
> Your solution would work if the data frame contained the raw data. In that
> case the table function as you outlined would be a table crossing all the
> levels of column 1 with all the levels of column 2.
> Instead my data frame is the table. It is an aggregate table (I may be using
> the wrong buzzwords here).

Does this help:

> foo <- Titanic[,2,2,]
> foo
      Survived
Class  No Yes
  1st   4 140
  2nd  13  80
  3rd  89  76
  Crew  3  20
> bar <- as.data.frame.table(foo)
> bar
  Class Survived Freq
1   1st       No    4
2   2nd       No   13
3   3rd       No   89
4  Crew       No    3
5   1st      Yes  140
6   2nd      Yes   80
7   3rd      Yes   76
8  Crew      Yes   20
> xtabs(Freq ~ Class + Survived, data = bar) # compare with foo
      Survived
Class   No Yes
  1st    4 140
  2nd   13  80
  3rd   89  76
  Crew   3  20

-Deepayan

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to