convert summarytools result to flextable

Hello team,
I use officer to generate a word document. It accept flextable and gg. I also need to add a result from summarytools package. But officer doesn't accept it. So, I need to convert the result to flextable.
Do you know if there is a way to do this (BTW, as_flex_table() doesn't work )?
Thank s,
Kai

Hi @yangkai9999,
You can do this by going via an xtable object (although the header lines in the summarytools object are lost):

library(summarytools)
library(flextable)
library(xtable)

tab1 <- descr(mtcars[,2:4])
class(tab1)

tab2 <- xtable(tab1)
class(tab2)

# 'Header' lines are lost on conversion
as_flextable(tab2)
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.