Search code examples
rflextable

flextable background colour issues


I am making a flextable using the iris dataset and have noticed an odd issue with the background colour function. I am trying to conditionally colour cells if they are over a certain value:

 regulartable(iris) %>%
   bg(i=1, j=which(iris[1,1:4] > 5), "green")

enter image description here

It works fine if at least one of the cells satisfies the condition for j, but if non of them do it colours the whole line rather than colouring nothing:

 regulartable(iris) %>%
   bg(i=1, j=which(iris[1,1:4] > 6), "green")

enter image description here

Is there a way to make it only colour if the condition is met? Also is this a feature or a bug in the flextable package?

Edit:

This has been resolved by version 0.5.1 of the flextable package.


Solution

  • Issue is now fixed in version 0.5.1 of flextable package