I have a dataframe with the following variables:

idnum   area    gender  race    etc.

I would like to make a table that looks like

area    gender  race
        M  F    B W A
1       4  5    3 5 1
2       6  7    4 6 3

etc.

Basically, I want to make a single broad table with a number of sub-set
tables. I have tried:

cbind(table(area, gender), table(area, race))

But, when I do this, I lose the labels gender / race. This makes it a
lot harder to understand my factor labels. when I use cbind, I get this:

M  F B W A
1 4  5 3 5 1
2 6  7 4 6 3

Although, it is technically correct, I really want to keep my factor
labels. I also tried this with xtabs and get the same results. Any
ideas? I saw a relatively recent thread asking a similar question, but
the proposed solution did not work for me, so I thought I would ask the
questions again.

If I am missing someting terribly obvious, I apologize.

thanks.


-- 
Insert something humorous here.  :-)

______________________________________________
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