Skip to content

3-way frequency table with kable #104

@philipp-stdr

Description

@philipp-stdr

@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

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)

2016-05-08 10 46 36 am

Any ideas how to fix this?

Thanks a lot!
Philipp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions