How to convert flextable object into dataframe ?

Hi, a flextable object is a list.
I have read this:

It seems that it is a special list as I tried and got an error saying that can't convert class flextable into class dataframe.

But maybe there is a way ?

My code:


X <- c("Q1", "Q2", "Q3", "Q4")
Y <- c(342, 435, 443, 224)

XY <- data.frame(X, Y)

flex_XY <- flextable(XY)

ft_1 <- add_header_row(flex_XY,
  values = c("", ""))

ft_1x <- ft_1 %>% flextable::add_header_row(top = TRUE, values = c("Something goes here", "")) |> merge_at(i = 1, j = 1:2,
 part = "header") |> flextable::align(align = "center", j = c(1:2), part = "header")

ft_1x |>

This topic was automatically closed 42 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.