在R-package文档(.Rd)文件中包含图像 [英] Including images in R-package documentation (.Rd) files

查看:277
本文介绍了在R-package文档(.Rd)文件中包含图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力在我的软件包中记录可视化功能.为此,我想通过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扩展"文档似乎无法解决此问题,我只能找到

'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!

推荐答案

未经测试,但查看GitHub上的R源,似乎他们将图像添加到

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆