简体   繁体   English

Knitr table 和 formattable 函数在 Rstudio & Shiny 中不起作用

[英]Knitr table and formattable functions don't work in Rstudio & Shiny

i'm trying to make my knitr tables (through KableExtra package) more appealing by adding some of the functions of the formattable package (ie colortile, ...).我试图通过添加 formattable 包(即 colortile,...)的一些功能来使我的 knitr 表(通过 KableExtra 包)更具吸引力。

But when running the code, the table gets visualized, but the table does not render the elements of the formattable.但是在运行代码时,表格会被可视化,但表格不会呈现格式表的元素。 However I can see the HTML code in the table where the formattable functions would have to take place (6th column in the printscreen below):但是,我可以在表格中看到必须执行 formattable 函数的 HTML 代码(下面打印屏幕中的第 6 列):

在此处输入图片说明

This is my code to render the table:这是我渲染表格的代码:

input_file %>%
            mutate(
            month_perc = color_bar("lightgreen")(month_perc)) %>%
            kable(format = 'html')%>%
            kable_styling(bootstrap_options = c("hover","striped"))

Probably this is an easy fix, but does anyone have an idea why it doesn't render?可能这是一个简单的修复,但有没有人知道为什么它不呈现?

Thanks in advance!提前致谢!

Kind regards,亲切的问候,

Simon西蒙

您需要在 kable 函数中使用 escape=F。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM