R ggplot Rmarkdown 输出乱码

The histograms below show the distribution of total steps (frequency and density).
```{r}
par(mfrow=c(1,2))
# frequencies
hist(total_steps_by_date$total_steps,
     breaks=30,
     xlab="Total Steps",
     main="Total Steps Per Day",
     col="lightblue")

大面积出现如下warning:


## Warning in grid.Call(L_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :

## 'mbcsToSbcs'里转换'11鏈<U+383C><U+3E38> 21 06:00'出错:<9c>代替了dot


## Warning in grid.Call.graphics(L_text, as.graphicsAnnot(x$label), x$x, x$y,
## : 'mbcsToSbcs'里转换'11鏈<U+383C><U+3E38> 22 00:00'出错:<88>代替了dot

查了很多资料,有说是fonts问题, 有说是packages没装好

最后

https://github.com/yihui/knitr/issues/527

给出的代码运行正常:

 windows() device

options(device = function(file, width = 7, height = 7, ...) {
  windows(width = width, height = height, ...)
})
插入在错误代码前面一段,再次运行
展开阅读全文

没有更多推荐了,返回首页