Reputation: 12152
The question is about R
and the flextable
package.
This simple R-output
> table(mtcars["gear"])
3 4 5
15 12 5
need to be converted to a flextable
.
But when I use flextable()
instead of table()
each observeration is shown and not the frequency of the 3 possible gears.
Upvotes: 0
Views: 2855
Reputation: 893
You need to convert the output of table()
into a data.frame
and then you can display it with flextable
. Flextable is only meant to display something, not to pivot it - as was mentioned in the comments. Try this:
flextable(data.frame(table(mtcars["gear"])))
Make sure to read the documentation of the packages you are using. ;)
Upvotes: 4