我的 rMarkdown ioslides_presentation 中的 formattable 不起作用

formattable in my rMarkdown ioslides_presentation doesn't work

我正在尝试在 rMarkdown 中使用 formattable 的示例 () ioslides_presentation 文档。一切正常,但幻灯片中的 table 看起来不像我 运行 它只是来自 R 而没有编织 HTML.

```{r echo=FALSE, results='asis',error=F, warning=F}
library(formattable)
library(plotly)

DF <- data.frame(Ticker=c("", "", "", "IBM", "AAPL", "MSFT"),
                 Name=c("Dow Jones", "S&P 500", "Technology", 
                        "IBM", "Apple", "Microsoft"),
                 Value=accounting(c(15988.08, 1880.33, NA, 
                                    130.00, 97.05, 50.99)),
                 Change=percent(c(-0.0239, -0.0216, 0.021, 
                                  -0.0219, -0.0248, -0.0399)))
DF

formattable(DF, list(
  Name=formatter(
    "span",
    style = x ~ ifelse(x == "Technology", 
                       formattable::style(font.weight = "bold"), NA)),
  Value = color_tile("white", "orange"),
  Change = formatter(
    "span",
    style = x ~ formattable::style(color = ifelse(x < 0 , "red", "green")),
    x ~ icontext(ifelse(x < 0, "arrow-down", "arrow-up"), x)))
)

```

如何在 ioslides_presentation 中获得与 table 相同的外观?

添加以下样式表:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

您也可以使其在本地可用,因为即使您在 YAML header.

中使用 self_contained: true,上述解决方案也需要互联网连接