Here is what I'm trying to accomplish
> table(mtcars$cyl)
4 6 8
11 7 14
And I need it in this format,
mtcars_table <- data.frame(
"4" = c(11),
"6" = c(6),
"8" = c(14))
> print(mtcars_table)
X4 X6 X8
1 11 6 14
I pretty much need the categorical variables as my columns and the counts as my row. If there is a dplyr way to this easier i'm open to it as well.