I am creating some descriptive statistics tables and I have a series of questions that have responses on the same 6-point scale. When I generate a table with my current code (below) it is long form (i.e., all responses are listed for each question. Is there a way to change this so that the responses are listed as column headers and the questions as rows. This would save space and be more aesthetically pleasing.
I'm sure there must be an easy way to do this but I am new to this package so a bit clueless
df %>% select(c(Q21_1,Q21_2,Q21_3,Q21_4,Q21_5)) %>% tbl_summary(
)%>%
modify_header(label ~ "")%>%
modify_spanning_header(c("label") ~ "**df**")
I think the
tbl_likert()
will do exactly what your need.https://mskcc-epi-bio.github.io/bstfun/reference/tbl_likert.html