saving flextable object in excel sheets

so i have many flextable objects in r script. now the objective is to save those objects in different sheets of excel.

i want to add one parameter in function like list1,list2... and at the end want to add the flex table object into that list.

library(flextable)
library(dplyr)

fun1 <- function(lst1,data, mv1, ov1) {
  ft <- flextable(data)
  
  row <- reformulate(paste(mv1, "> 20"))
  col <- reformulate(ov1)
  
  color(ft, i = row, j = col, color = "blue")
  
  ft
lst1 <- lst1[length(lst1)+1]
}

ft <- fun1(head(mtcars), "mpg", "gear")

seems like you are trying to do this

library(flextable)
library(dplyr)

fun1 <- function(lst1,data, mv1, ov1) {
  ft <- flextable(data)
  
  row <- reformulate(paste(mv1, "> 20"))
  col <- reformulate(ov1)
  ft <- color(ft, i = row, j = col, color = "blue")

  lst1[length(lst1)+1]  <- list(ft)
  lst1
}

ft <- fun1(list(),head(mtcars), "mpg", "gear")
ft <- fun1(ft,head(iris)*4, "Sepal.Length", "Petal.Width")

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.