1

下面的块在终端内运行良好,但在通过 knitr(或者更确切地说,rmarkdown)运行时会失败。

---
title: "test-svg"
author: "foo"
date: "8/12/2018"
output: html_document
---

# Title

```{r}
# please download this file     https://www.dropbox.com/s/kcir2yuuyunw857/live_2_work.svg
# downloading in R may not work
# read it in / convert it
res <- grImport2::readPicture(file = "live_2_work.svg", warn = FALSE)
res <- grImport2::pictureGrob(picture = res)
# plot it on empty canvas
grid::grid.newpage()
grid::grid.draw(x = res)
# works!
```

通过knitr,它会出错:

Error: 1: xmlParseEntityRef: no name 2: xmlParseEntityRef: no name (...)

我四处搜索,但找不到任何关于此的信息,我很困惑为什么 knitr 的行为与正常绘图不同。

这里发生了什么?

4

0 回答 0