带有self_contained的Rmarkdown中的重音错误:FALSE和小部件(dygraphs和其他)

时间:2016-04-13 19:14:14

标签: r knitr r-markdown dygraphs

我正在尝试使用dygraphs和使用源文件制作html Rmarkdown。 当我使用self_contained: TRUE时,我没有遇到任何问题,但是当我使用self_contained: FALSE时,图例重音会出错。

dygraph with self_contained: FALSE. The correct would be "Orgânico"

如果我在没有来源的情况下使用,那没关系,但我需要在我的情况下使用来源。

这里我放了一个可重现的代码:

来源(tilemaker.R)

ptcolsumm <-  c("Usuários", "Sessões", "Pageview Único", "Pageviews",  "Tempo Médio", "Rejeição", "Taxa de Rejeição", "Taxa de Saída", "não sei", "ACENTUAÇÃO", "Teste")

organic <- data.frame(organic = as.numeric(c(186,640,278,11,267,117,41,17,38)))
organic <- as.ts(organic)

# Facebook impressions by type
teste <- dygraph(organic) %>%
  dySeries("organic", label = "Orgânico") %>%
  dyLegend(width = 400, show = "always") %>%
  dyOptions(fillGraph = TRUE, fillAlpha = 0.2, drawGrid = FALSE, drawPoints = TRUE, pointSize = 2)

Rmd:

---
title: "Habits"
output:
  html_document:
    theme: flatly
    highlight: tango
    self_contained: FALSE
---
```{r source}
require(magrittr)
require(dygraphs)
source("tilemaker.R", encoding = "UTF-8")
```
<style> /* CSS style to solve the problem with the sparkline tooltip */
.jqstooltip {
  -webkit-box-sizing: content-box;
  -moz-box-sizing: content-box;
  box-sizing: content-box;
}
</style>

## Quarterly Results {.tabset}

### By Region

```{r3}

teste

```

### BLOH BLOH 3
TESTE DE 3 DIVISÕES

如果我不使用标签,它也可以,但我也需要它。

1 个答案:

答案 0 :(得分:0)

@Yihui解决了这个问题。 问题出在html工具包中。

立即解决问题:

devtools::install_github('rstudio/htmltools@bugfix/utf8-preserved-chunks')`

我认为他们会在htmltools包的下一个版本中合并这个块,所有新的instalations都会解决问题。