[R] ftable and data.frame

arun smartpink111 at yahoo.com
Fri Dec 20 15:05:20 CET 2013


Hi,
Try:
library(reshape2)
dcast(as.data.frame(tab1), SEX+ESTCIV~Q1,value.var="Freq") ##not tested.

A.K.




On Friday, December 20, 2013 8:03 AM, "silvano at uel.br" <silvano at uel.br> wrote:
Hi,

I used this command to produce a table:

(tab1 = ftable(SEX, ESTCIV, Q1))

                               Q1  B  L  M  N
SEXO    ESTCIV
        F           A         11 13  4  2
                      E          1  0  0  0
        M           A          5  0  3  1
                      E          0  0  0  0

but I need something like:


SEXO    ESTCIV        B  L  M  N
      F            A         11 13  4  2
      F            E          1  0  0  0
      M           A          5  0  3  1
      M           E          0  0  0  0

How can I get it?

I need this format to use ordinal logistic regression and I have many tables.

Thanks,

Silvano.

---
Este email está limpo de vírus e malwares porque a proteção do avast! Antivírus está ativa.


    [[alternative HTML version deleted]]

______________________________________________
R-help at 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.




More information about the R-help mailing list