R——可能不是由 Sweave 制作的晕影吗?
我可以在 pkg/doc 文件夹中包含一些 PDF 以便 vignette
功能正常工作,但不存在相应的 Rnw、Rtex 等吗?
我正在考虑包含用 R 块编织的 markdown 文本的幻灯片或文档,它们具有不同的构建过程,因此具有不同的文件扩展名。
编写 R 扩展指南建议应该可以包含在安装时无法构建的文档,但是 vignette
函数似乎会查找具有特殊扩展名(Rnw、Rtex 等)的文件,并且也适用于名为 vignette.rds
的文件。
任何提示表示赞赏。
Can I include some PDF in the pkg/doc folder so that the vignette
function works, but no corresponding Rnw, Rtex, etc exists?
I am thinking of slides or documents containing markdown text weaved with R chunks, which have a different build process and hence different file extensions.
The writing R extensions guide suggests that it should be possible to include documents which can not be build at installation time, but the vignette
function seems to look for files with special extensions (Rnw, Rtex, etc) and also for a file called vignette.rds
.
Any hints are appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
几年前我问过这个问题,虽然弗里茨·莱施(Fritz Leisch)同意这个想法,但他没有时间实施它。
I asked about this several years ago, and while Fritz Leisch is amenable to the idea, he hasn't had the time to implement it.
(交叉发布于我刚刚在 R-help 上留下的回复:)
作为解决方法,您可以在包中包含您自己的
xvignette
函数:请参见下文。它不会向您显示索引,但会选取您的
inst/doc
目录中包含的任何适当命名的文件。包...
您必须以某种方式提醒您的包用户这个替代文档存在的事实 - 也许在包本身的帮助文件中。
您可以用您的包名称填写上面的
pkg
的默认值,以方便用户:我考虑过使用getPackageName(environment(xvignette))
的某些变体自动完成,但这似乎太复杂了......Brian Ripley 在回答问题时还提到:
...但我不知道“很快”是什么意思(我认为 2.14.0 发布大约需要 6 个月)
编辑: http://article.gmane.org/gmane.comp.lang.r.devel/28449 详细介绍了另一个解决方法(创建一个包含现有 PDF 文件的虚拟小插图)
编辑 2:以下
R.rsp包
(Cross-posted from a response I just left on R-help:)
As a workaround, you could include your own
xvignette
function in your package: see below.It won't show you indices, but it will pick up any appropriately named file that you include in the
inst/doc
directory of yourpackage ...
You'll have to somehow alert your package users to the fact that this alternative documentation exists -- perhaps in the help file for the package itself.
You might fill in the default value of
pkg
above with your package name to make it easier on the user: I thought about using some variant ofgetPackageName(environment(xvignette))
to do it automatically, but that seems too complicated ...Brian Ripley also mentioned in his response to the question that:
... but I don't know what "soon" means (it will be about 6 months until 2.14.0 comes out, I think)
edit: http://article.gmane.org/gmane.comp.lang.r.devel/28449 details another workaround (creating a dummy vignette that incorporates the existing PDF file)
edit 2: And
R.rsp
package从 R 3.0.0 开始,本机支持此功能,请参阅 http://yihui.name/knitr/demo/小插图/。
使用
knitr
作为晕影引擎的说明归结为:另请参阅有关该主题的官方 R 文档 。
This is supported natively as of R 3.0.0, see http://yihui.name/knitr/demo/vignette/.
Instructions to use
knitr
as vignette engine boil down to:See also the official R documentation on that topic.