带有knitr :: rmarkdown_notangle的未评估小插曲 [英] non-evaluated vignettes with knitr::rmarkdown_notangle

查看:90
本文介绍了带有knitr :: rmarkdown_notangle的未评估小插曲的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

knitr软件包相对较新地添加了新的notangle小插图引擎,例如knitr::rmarkdown_notangle,这些引擎允许禁用小插图块的评估.在此处中描述了使用knitr进行小插曲的一般过程,而具体的

我确定我在做些蠢事.有任何线索吗?

更新:我可以通过将eval=FALSE显式添加到每个块的选项中来获得所需的信息(阻止对所有块进行评估),但我仍然想知道发生了什么...

解决方案

这是knitr当前版本中的一个错误,已经开发版本 1.7.9中,该版本(希望是在CRAN上为v1.8)将来.

The knitr package has relatively recently added new notangle vignette engines, such as knitr::rmarkdown_notangle, that allow disabling of evaluation of vignette chunks. The general process of using knitr for vignettes is described here, while the specific notangle functionality is described in an answer to this question.

My problem is that I can't get this to work. I can get it to pass R CMD build by including the .html output in the vignettes directory (I also put a copy in inst/doc), but I can't get it to pass R CMD check unless I specify --no-build-vignettes, or unless I change the rmarkdown_notangle engine back to rmarkdown.

I have built a trivial package that contains the following vignette (in vignettes/notangle.rmd): it's available here.

<!--
%\VignetteEngine{knitr::rmarkdown_notangle}
%\VignetteIndexEntry{Supplementary Materials}
-->
A silly little vignette.

```{r}
2+2
```

My DESCRIPTION file includes

Suggests:
    knitr,
VignetteBuilder: knitr
BuildVignettes: yes

When I try to run R CMD check I get

* checking re-building of vignette outputs ... NOTE
Error in re-building vignettes:
   ...
Error: processing vignette 'notangle.rmd' failed with diagnostics:
Failed to locate the ‘weave’ output file (by engine ‘knitr::rmarkdown_notangle’) 
   for vignette with name ‘notangle’. The following files exist in directory ‘.’:
   ‘notangle.rmd’

Using r-devel (2014-09-17 r66626), but also happens with 3.1.1.

The workaround (which I would strongly prefer to avoid) is to switch from R code chunks to generic code chunks (opens with triple-backtick, rather than triple-backtick+"r"), which Rmarkdown doesn't process.

I'm sure I'm doing something boneheaded. Any clues?

update: I can get what I need (stop all chunks from being evaluated) by explicitly adding eval=FALSE to the options of every chunk, but I'd still like to know what's going on ...

解决方案

It is a bug in the current version of knitr, and it has been fixed in the development version 1.7.9, which will (hopefully) be v1.8 on CRAN in the future.

这篇关于带有knitr :: rmarkdown_notangle的未评估小插曲的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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