Open philipp-stdr opened 8 years ago
@christophergandrud Hi, I'm struggling to knit a 3-way frequency table with row probabilities. I thought I could use the kable function.
This is the code of my table:
`## 3-Way Frequency Table
ge_sp_ca1 <- table(z$sexcat[z$educat==4 & z$married==1], z$income_status[z$educat==4 & z$married==1], z$spwrkcat[z$educat==4 & z$married==1]) ftable(prop.table(ge_sp_ca1, c(1,2)))`
Which yields the following output:
I thought I could use a simple kable command to knit it but it produces a completely wrong table:
knitr::kable(ftable(prop.table(ge_sp_ca,c(1,2))), caption = "Gender and Spouse Work Status",digits = 2)
Any ideas how to fix this?
Thanks a lot! Philipp
Try the pander solution mentioned in: http://stackoverflow.com/questions/25516471/printing-nice-cross-tabulations-in-knitr.
pander
@christophergandrud Hi, I'm struggling to knit a 3-way frequency table with row probabilities. I thought I could use the kable function.
This is the code of my table:
`## 3-Way Frequency Table
Gender, income and Spouse Work Status (row probabilities)
ge_sp_ca1 <- table(z$sexcat[z$educat==4 & z$married==1], z$income_status[z$educat==4 & z$married==1], z$spwrkcat[z$educat==4 & z$married==1]) ftable(prop.table(ge_sp_ca1, c(1,2)))`
Which yields the following output:![image](https://cloud.githubusercontent.com/assets/17119955/15097692/12961ae4-1524-11e6-937a-80a5e64e81d7.png)
I thought I could use a simple kable command to knit it but it produces a completely wrong table:
knitr::kable(ftable(prop.table(ge_sp_ca,c(1,2))), caption = "Gender and Spouse Work Status",digits = 2)
Any ideas how to fix this?
Thanks a lot! Philipp