在R-package文档(.Rd)文件中包含图像 [英] Including images in R-package documentation (.Rd) files
问题描述
我正在努力在我的软件包中记录可视化功能.为此,我想通过Rd文件'funcname.Rd'嵌入一个图像,该图像可以解释该函数中使用的各种参数,并且如果用户去阅读软件包手册PDF或写'?funcname,则该图像会弹出. R中的内容.
I am working to document a visualization function in a package of mine. For this purpose I would like to have an image embedded through the Rd-file 'funcname.Rd' that could explain various parameters utilized in the function, and which would pop up if user goes to read the package manual PDF or writes '?funcname' in R. Something in the lines of:
编写R扩展"文档似乎无法解决此问题,我只能找到此R-devel讨论.前者指向名为"base64"的程序包的链接断开,而后者仅解决了各种替代方法,例如将图像包含在R程序包中.如果这可以与CRAN兼容,那就太好了.
'Writing R extensions'-document doesn't seem to address this issue, and the only references I could find were this blog post and this R-devel discussion. The former has a broken link to a package called 'base64' and the latter only addresses various alternatives like including the images in R package vignettes instead. It would be great if this could be CRAN-compatible.
对于如何解决此问题的任何建议,我们将不胜感激!
Any advice on how to approach this issue would be appreciated, thanks!
推荐答案
Untested, but look at the R source on GitHub, it would appear they add an image to ?par
documentation file in the following manner:
\item{\code{mai}}{A numerical vector of the form \code{c(bottom,
left, top, right)} which gives the margin size specified in
inches.\cr
\if{html}{\figure{mai.png}{options: width="35\%" alt="Figure: mai.png"}}
\if{latex}{\figure{mai.pdf}{options: width=7cm}}
}
该图似乎已保存在/man/figures
中.
有关更多详细信息,请参见编写R扩展"部分关于该主题.
For more details see the Writing R Extensions section on the topic.
这篇关于在R-package文档(.Rd)文件中包含图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!