ftable and data.frame
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.