I have a table and I would like to do an excel bargraph-like (What I want to do) I have a problem with negative values that don't reverse the graph (what I have now). As you can see I have the value -5 that is not reverse and is not proportionnal. I would like if it is negative I reverse the bar.
my csv database
my code :
library(knitr)
library(kableExtra)
library(formattable)
library(dplyr)
library(stringr)
dat = read.csv("/dat.csv", header = TRUE, sep =';')
dat[] %>%
mutate(
KP1 = color_bar("lightgreen")(KP1),
KP2 = color_bar("lightgreen")(KP2),
KP3 = color_bar("lightgreen")(KP3),
Exposure.1 = color_bar("lightgreen")(Exposure.1),
Exposure.2 = color_bar("lightgreen")(Exposure.2),
KP4 = color_bar("lightgreen")(KP4),
KP5 = color_bar("lightgreen")(KP5)
) %>%
kable("html", escape = F) %>%
kable_styling("hover", full_width = F) %>%
column_spec(5, width = "10cm") %>%
column_spec(1,color = 'black', bold = T, border_right = T) %>%
column_spec(1:5,width = "12.5%") %>%
row_spec(2,extra_css = "border-top = 10px")
Thank you in advance