我正在使用formattable包制作一个表,这是我拥有的表和代码。
DataName = h1
customGreen0 = "#DeF7E9"
customGreen = "#71CA97"
customRed = "#ff7f7f"
improvement_formatter <- formatter("span",style = x ~ style(font.weight = "bold",color = ifelse(x > 0,customGreen,ifelse(x < 0,customRed,"black"))),x ~ icontext(ifelse(x<0,"arrow-up","arrow-down"),x)
)
formattable(h1,align =c("l","c","c"),list(
`Totals` = formatter("span",style = ~ style(color = "grey",font.weight = "bold")),`2011`= color_tile(customGreen,customGreen0),`2012`= color_tile(customGreen,`2013`= color_tile(customGreen,`2014`= color_tile(customGreen,`2015`= color_tile(customGreen,`2016`= color_tile(customGreen,`2017`= color_tile(customGreen,`2018`= color_tile(customGreen,`2019`= color_tile(customGreen,`Average` = color_tile(customRed,customRed),`Change Since 2011` = improvement_formatter
))
h1[3,12] = "N/A"
这是我得到的输出
对于第3行,第12列,我需要将其设置为N / A,但不要将其设置为绿色或具有向上/向下箭头。是否可以变黑和/或使用向左箭头指示该数据不可用?