How can RMarkdown correctly color the largest percentage in each row of Kable? The code below incorrectly colors the cell based on the descend order from the 1st digit of the percentages. Thank you in advance! Code:
---
title: "Color Max Percentage"
output:
html_document: default
pdf_document: default
---
```{r setup, include = F}
library(tidyverse)
library(knitr)
library(kableExtra)
options(knitr.table.format = "html")
df = data.frame(
x = c(1, 2, 3, 4, 5),
a = c("12.7%", "14.0%", "49.2%", "20.4%", "23.2%"),
b = c("35.6%", "19.0%", "9.1%", "25.5%", "11.2%"),
c = c("6.9%", "54.1%", "31.3%", "15.4%", "17.5%")
)
df <- df %>%
# adorn_totals('row') %>%
rowwise() %>%
mutate(across(a:c, ~cell_spec(.x, format = "html",
color = ifelse(.x == max(c_across(a:c)), "red", "blue"))))
df %>%
kable(escape = F) %>%
kable_styling()
```

