Could not find function setflextablebackgroundcolors

My code,

cormatrix = (cor(myCareer))
c = flextable(as.data.frame(round(cormatrix, 3), add.rownames = TRUE))
c = setflextableBackgroundcolors(c, i = 1, colors = “gray”,  to = “ header”)

not sure why I got the error message.
Please advise.

flextable do not have such a function. Check the list of functions here or here.

However, a function of similar name was available in the archived ReporteRs package.

You can use the bg function similarly. Does this help?

library(flextable)
library(magrittr)
library(tibble)

cormatrix <- cor(x = mtcars)

cormatrix %>%
  round(digits = 3) %>%
  as.data.frame() %>%
  rownames_to_column(var = "variables") %>%
  flextable() %>%
  bg(i = 1,
     bg = "gray",
     part = "header")

I still see that after merging two cells that the borders is missing. Not sure why.

With the last code, the background color works. Thank you !!

The issue I have is when I merge the cells that are adjacent to each other the borders are missing.

Is this message,

No one seems to answer yet.

I haven't seen this other thread before. Will attempt.

Meanwhile, since your original problem on this thread is solved, will you consider choosing a solution for the present thread?