[R] How do I make a Sweave + latex table out of this ?

Fredrik Karlsson dargosch at gmail.com
Thu Aug 18 16:27:36 CEST 2005


Dear list,

I have a table that I would like to convert to latex for inclusion
into a Sweave file.


> round(ftable(prop.table(xtabs(~agemF + votcat + Type , data=work),margin=2))*100,1)
                  Type Voiced Voiceless unaspirated Voiceless aspirated
agemF   votcat                                                         
18 - 24 Prevoiced         2.6                   8.7                 2.3
             Short lag         5.8                   6.7                 5.1
            Long lag          1.0                   1.9                 2.9
24 - 30 Prevoiced        15.1                  10.5                 1.7
             Short lag         9.2                  15.3                 5.8
            Long lag          3.5                   8.1                15.8
30 - 36 Prevoiced        12.8                  14.0                 2.6
            Short lag        10.2                  14.2                 3.0
            Long lag          2.3                   5.5                22.2
36 - 42 Prevoiced         4.4                   6.4                 0.6
           Short lag         4.0                   5.9                 1.5
           Long lag          1.3                   2.9                 9.4
42 - 48 Prevoiced         6.4                   2.3                 0.3
           Short lag         3.0                   2.8                 1.4
           Long lag          0.6                   7.7                 8.8
48 - 54 Prevoiced         4.9                   4.1                 0.3
            Short lag         2.0                   2.7                 1.3
             Long lag          0.3                   0.9                 4.7


However, I have not been able to use this as a table. The Hmisc latex
command only accepts the input if I first convert it to a data.frame
format, and that makes the output much more difficult to read as it
duplicates the category levels of agemF.

Is there a way to do this?


/Fredrik Karlsson




More information about the R-help mailing list