Crosstab with multiple items
        Posted  
        
            by Michael Wexler
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Michael Wexler
        
        
        
        Published on 2010-03-19T18:28:11Z
        Indexed on 
            2010/03/19
            18:31 UTC
        
        
        Read the original article
        Hit count: 294
        
r
In SPSS, it is (relatively) easy to create a cross tab with multiple variables using the factors as the table heading. So, something like the following (made up data, etc.). Q1, Q2, and Q3 each have either a 1, a 2, or a 3 for each person.
                        1 (very Often)   2 (Rarely)   3 (Never)
   Q1. Likes it           12              15             13
   Q2. Recommends it      22              11             10
   Q3. Used it            22              12             9
In SPSS, one can even request row, column, or total percentages.
I've tried table(), ftable(), xtab(), CrossTable() from gmodels, and CrossTable() from descr, and none of these can handle (afaik) multiple variables; they mostly seem to handle 1 variable crossed with another variable, and the 3rd creates layers.
Is there a package with some good cross tabbing/table examples that I could use to figure this out? I'm sure I'm missing something simple, so I appreciate you pointing out what I missed. Perhaps I have to generate each row as a separate list and then make a dataframe and print the dataframe?
© Stack Overflow or respective owner