在 R 包文档 (.Rd) 文件中包含图像

编程入门 行业动态 更新时间:2024-10-27 07:31:48
本文介绍了在 R 包文档 (.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:

'Writing R extensions'-document 似乎没有解决这个问题,我能找到的唯一参考资料是 这篇博文 和 这个 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!

推荐答案

未经测试,但是查看 GitHub 上的 R 源代码,似乎他们将图像添加到 ?par 文档文件,格式如下:

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 中.

The figure appears to be saved in /man/figures.

有关详细信息,请参阅 编写 R 扩展部分 关于主题.

For more details see the Writing R Extensions section on the topic.

更多推荐

在 R 包文档 (.Rd) 文件中包含图像

本文发布于:2023-11-17 03:54:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1608737.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图像   文档   文件

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!