Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Var labels and qualitative variables #120

Open
areus20 opened this issue Jul 24, 2020 · 5 comments
Open

Var labels and qualitative variables #120

areus20 opened this issue Jul 24, 2020 · 5 comments

Comments

@areus20
Copy link

areus20 commented Jul 24, 2020

I was using the summarytools (freq) package for tables, and in the case of quantitative variables, there is no problem grouping multiple variables into a single table (except the variable label is not shown). But for several qualitative variables with the same categories, I can't find the option to collapse all in 1 single table, where the columns correspond to the categories. Thanks for the help.

@dcomtois
Copy link
Owner

Hi, could you show a rough example of what your desired output would be pls?

@areus20
Copy link
Author

areus20 commented Jul 25, 2020

An example would look like the table on the next page: https://community.rstudio.com/t/table-with-kable-and-formattable/30565, were orange grape and apple whe the variables that have the same categories ( A B C) and in the boxes you get frequency (and percentage ideally). Thanks!

@dcomtois
Copy link
Owner

dcomtois commented Jul 25, 2020

Ok, let's simplify this a bit. Say you have this table. What would the frequency table you have in mind table look like?

col1 col2 col3
a a a
a b b
c b c

PS: You can use a tool like this one to create markdown tables: https://www.tablesgenerator.com/markdown_tables

@areus20
Copy link
Author

areus20 commented Jul 26, 2020

Thanks!
Something like this data frame with factor variables col1,col2,col3 (1,2,3 are categories)

col1 col2 col3
2 3 1
3 1 1
2 1 3

To this table:

col1 col2 col3
1 1 (33.3%) 2 (%) 2 (%)
2 2 (66.6%) 0 (%) 0 (%)
3 0 (0%) 1 (%) 1 (%)

@dcomtois
Copy link
Owner

dcomtois commented Aug 6, 2020

Seems easy enough... I just don't have much time on my hands this summer, so unless someone wants to give it a shot, it will probably have to wait a few more months.

Thanks for your suggestion, it's a neat idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants