使用pander的实时报告生成时如何添加现有图像?

时间:2014-04-22 20:42:33

标签: r pandoc pander

我很遗憾地使用Windows 7,这可能是问题......

我想将现有的图像文件添加到pander报告中,使用Windows平台上的实时报告生成,输出到docx:

library(pander)
setwd("T:/R/Temp") #this contains the subfolder & file /plots/temp.png
myReport = Pandoc$new(author="Jerubaal",title="Where's my picture?", format="docx")
myReport$add.paragraph("There should be a picture after this.")
myReport$add(pandoc.image("/plots/temp.png"))
myReport$add.paragraph("There should be a picture before this.")
myReport$export()

唉,在Windows中运行它时没有包含图像(甚至在md文件中也没有)。

如果我尝试直接输入代码,它就无法工作:

myReport$add("![](/plots/temp.png)")

如果我试试这个:

myReport$add("![/plots/temp.png](/plots/temp.png)")

我只是获取路径的文本:/ plots/temp.png

有什么建议吗?

仅供参考:前一段时间,尝试ggplot,我让它在Ubuntu中工作:earlier question

此报告是使用R(3.0.3)和pander(0.3.9)在x86_64-w64-mingw32平台上以0.02秒生成的。

0 个答案:

没有答案