![](/img/trans.png)
[英]How to process UTF-8 characters for an ioslides_presentation generated with rmarkdown
[英]formattable in my rMarkdown ioslides_presentation doesn't work
我試圖用一個例子( 聯系我rMarkdown ioslides_presentation文檔中的formattable)。 一切工作正常,但是如果我僅從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中獲得表的相同外觀?
添加以下樣式表:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
您也可以使其在本地可用,因為即使您在YAML標頭中使用self_contained: true
,上述解決方案也需要Internet連接。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.