如何在HTML文档中生成带有图标的表格。使用rmarkdown创建

时间:2020-01-27 23:41:21

标签: html r r-markdown kable

我想用带有图标(箭头)的表创建一个html报告,但是当它适用于闪亮或flexdashboard时,当我将其编织为html格式时似乎不起作用。有没有办法在html输出中生成这样的表?

---
title: "Leads Report"
output: html_document
---

```{r global, include=FALSE}
knitr::opts_chunk$set(echo = TRUE,fig.width = 14)
library(shiny)
library(shinydashboard)
FCB<-c(5,6,4,6,8)
TWI<-c(3,5,2,3,5)
IN<-c(2,1,1,1,1)
DF1<-data.frame(FCB,TWI,IN)

FCB<-c(0,0,1,2,4)
TWI<-c(1,2,3,4,5)
IN<-c(1,3,4,5,6)
DF2<-data.frame(FCB,TWI,IN)

DF1$direction <- ifelse(DF2$FCB-DF1$FCB > 0, 
                     paste("<p>&#8593;</p>"), 
                     ifelse(DF2$FCB-DF1$FCB  < 0, 
                            paste("<p>&#8595;</p>"), 
                            paste("<p>&#8646;</p>")))
```

#### Table

```{r plot1, echo=FALSE,results='hide', message=FALSE, warning=FALSE }

knitr::kable({DF1}, sanitize.text.function = function(x) x,escape = F)

```

0 个答案:

没有答案