Quantcast
Channel: Active questions tagged kable - Stack Overflow
Viewing all articles
Browse latest Browse all 105

Rendering kable/formattable in Quarto markdown, icons don't show up in output HTML

$
0
0

I'm trying to render a table in R Quarto where one of the columns contains a color-coded symbol. When I run it within RStudio, everything looks as expected, but when I hit render the symbols are missing entirely.In RStudio:table with correct color-coded symbols in second columnIn the HTML:table with blank second column

I switched from using formattable to using kable, I made sure to add results = "asis", format = "html", and escape = F, as I saw mentioned around a few times, but nothing changed. Here is the code that created the pictures:

---title: "stackoverflow"format:   html:    embed-resources: true    page-layout: full    fig-width: 20    fig-height: 20editor: visual---```{r Package Imports}#| include: false#| echo: falseoptions(knitr.table.format = "html") library(dplyr)library(lubridate)library(DBI)library(formattable)library(tidyverse)library(knitr)library(data.table)library(kableExtra)``````{r table, echo = FALSE, results = "asis"}df <- data.frame(name = c("red", "yellow", "green"),                 symbol = c(-0.5, -0.01, 0.5))#Creating a custom formatter for the color + asteriskcustom_indicator <- formatter("span", style = x ~ style(color = ifelse(x < -0.1, "red",                                                ifelse(x >= 0, "green", "yellow"))),                              x ~ icontext(sapply(x, function(x) "asterisk")))df %>%   mutate(symbol = custom_indicator(symbol)) %>%   kableExtra::kbl(format = "html", escape = F) %>%   kableExtra::kable_styling()```

Viewing all articles
Browse latest Browse all 105

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>