【发布时间】:2022-12-28 03:41:47
【问题描述】:
I have a dataframe with data from a survey. I would like to produce a report in table format with the frequencies of each variable.
So working with the dataset mtcars, having this:
> count(mtcars, cyl)
cyl n
1 4 11
2 6 7
3 8 14
> count(mtcars, gear)
gear n
1 3 15
2 4 12
3 5 5
I would like to produce a table like this (or something similar):
| variable | n |
|---|---|
| cyl | |
| 4 | 11 |
| 6 | 7 |
| 8 | 14 |
| gear | |
| 3 | 15 |
| 4 | 12 |
| 5 | 5 |
Any idea as to how this may be achievable?
【问题讨论】:
标签: r dplyr r-markdown reporting flextable