R formattable - Receiving an error while using style

Viewed 111

Im trying to use style function as part of formattable but im receiving an error each time im adding the style and im not sure what the issue,

while im using the following query the export is fine

library(tibble)
library(formattable)  
library(rmarkdown)
library(dplyr)

        formattable(x_test, list(
      area(col = customers) ~ normalize_bar("pink", 0.5),
      goal = color_tile("white", "orange")
      ))

and im receiving the following html

enter image description here

but when im trying to display up and down arrow depending on the union_pre and goal results

    formattable(x_test, list(
      area(col = customers) ~ normalize_bar("pink", 0.5),
      goal = color_tile("white", "orange"),
      union_pre = formatter("span", style = ~ style(color = ifelse(union_pre >goal, "red", "green")),                
            ~ icontext(ifelse(union_pre >goal,"arrow-up", "arrow-down"), union_pre))  
  ))

I'm receiving the following error :

Error in style(color = ifelse(union_pre > goal, "red", "green")) : 
  unused argument (color = ifelse(union_pre > goal, "red", "green"))
0 Answers
Related