【发布时间】:2018-06-12 18:57:06
【问题描述】:
我正在处理 svg 的列表以打印到 html 文档。我正在使用magick 包,以为我愿意使用其他包/解决方案。下面的代码是我尝试呈现我的 html 文档。但是,它不是将svg 呈现到 html 文件,而是简单地将元数据打印到文档中。有没有办法克服这种行为?
---
title: "My Test Report"
author: "Nicholas Hayden"
date: "6/12/2018"
output: html_document
---
```{r setup, set-options, include=FALSE, warning=FALSE}
library(rsvg)
library(magick)
paths <- c(
"~/path/to/my1.svg",
"~/path/to/my2.svg")
for (i in 1:length(paths)) {
print(image_read_svg(paths[i]))
}
```
编辑:
一些说明问题的例子。
Rmd 命令:
 失败并产生...
File "/Users/nicholashayden/Desktop/path/to/my1.svg" not found in resource path
Error: pandoc document conversion failed with error 99
正如@mikeck 指出的那样。这可能是一个路径问题。但是,尝试不使用 ~ 会产生相同的错误。
<img src="/Users/nicholashayden/path/to/my1.svg"> 的 html 纯文本将图像放在 html 文档中,而 ~ 版本失败并出现与之前相同的错误。
knitr::include_graphics() 方法生成带有绝对路径或带有~ 的路径的空格
【问题讨论】:
标签: r svg r-markdown