Has anyone had the following issue with gt table?
Regardless of the value I set for the tab style row argument the whole column gets hit with the color argument. I only want the "Paid Per Episode" column to color it blue when it is greater than 33000.
Could this be something with R markdown?
hip_dt_epsd_table %>%
rename(State = JUR_ST_ABBR_PRIM, Episodes = epsd_count, "Paid Per Episode" = pd_per_epsd, "Episodes Outlier" = epsd_outlier,
"Paid Per Episode Outlier" = pd_epsd_outlier,
"Episodes 99th Percentile" = epsd_count_99th) %>%
gt() %>%
fmt_currency(columns=vars("Paid Per Episode","Paid Per Episode Outlier")) %>%
fmt_number(columns=vars("Episodes","Episodes Outlier","Episodes 99th Percentile"),sep_mark=",", drop_trailing_zeros = TRUE) %>%
tab_style(
style = cell_fill(color = "lightblue"),
locations = cells_body(
columns = "Paid Per Episode",
row = "Paid Per Episode" > 33000))
Since you did not provide an example I have used mtcars
dataset.
library(gt)
mtcars %>%
gt() %>%
tab_style(style = cell_fill(color = "lightblue"),
locations = cells_body(columns = "disp",rows = disp > 250))