How to change output for N/A on tables using formattable package in R

Capture d’écran 2020-10-27 à 09.25.24

I would like to remove the arrow when it's not a percent.

my R code is :

list( "Evolution" = formatter("span"
 , style = x ~ formattable::style(color = ifelse(x == "Données sur T-1 non disponibles", "grey"
 ,ifelse(x>0 & x!="Inf" & x != "NaN", "green"
 ,ifelse(x<0 & x != "NaN","red","grey"))))
 , x ~ icontext( ifelse(x < 0, "arrow-down", "arrow-up") , x))

Any idea ??
Thanks :slight_smile:

change the icontext logic

x ~ icontext(ifelse(is.numeric(x), ifelse(x < 0, "arrow-down", "arrow-up"),
  ), x)
1 Like

Many thanks, it works :smiley:

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