Behavior of `R CMD build` depending of Rd content - r

R CMD build behaves differently whether a Rd file contains \PR{} or not. See Writing R Extensions for details on the macros.
Example when a Rd file does not contain \PR{}:
$ R CMD build test
* checking for file 'test/DESCRIPTION' ... OK
* preparing 'test':
* checking DESCRIPTION meta-information ... OK
* installing the package to process help pages
* saving partial Rd database
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building 'test_0.1.tar.gz'
Example when a Rd file contains \PR{}:
$ R CMD build test
* checking for file 'test/DESCRIPTION' ... OK
* preparing 'test':
* checking DESCRIPTION meta-information ... OK
* installing the package to process help pages
* saving partial Rd database
* building the PDF package manual # <- this
Hmm ... looks like a package # <- this
Converting Rd files to LaTeX # <- this
Creating pdf output from LaTeX ... # <- this
Saving output to 'xxx/test.pdf' ... # <- this
Done # <- this
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building 'test_0.1.tar.gz'
The additional stage (i.e. building the PDF package manual, which can be quite slow on an old computer...) is due to the call to ..Rd2pdf in .build_packages (lines 619-625). However I do not understand what triggers this stage. In addition, it is triggered only for \PR{} and not for other macros such as \CRANpkg{} and \doi{}.
Can someone trace back what happens and why? The question is on base R functions only. I do not use helpers such as devtools.
Minimal test package
Package structure
test
test/man
test/man/one.Rd
test/R
test/R/one.R
test/DESCRIPTION
test/NAMESPACE
test/man/one.Rd
\name{one}
\alias{one}
\title{Get One}
\description{
Rd file containing or not the PR macro:
\PR{1} % comment/uncomment this line as needed
but containing other macros:
\CRANpkg{ggplot2} and \doi{10.1002/wics.147}
}
\usage{
one()
}
test/R/one.R
one <- function() 1
test/DESCRIPTION
Package: test
Version: 0.1
Title: Test
Author: Nobody
Maintainer: Nobody <no#body.org>
Description: Test.
License: GPL-3
test/NAMESPACE
export(one)
Build, check, and install with:
$ R CMD build test
$ R CMD check test_0.1.tar.gz
$ R CMD INSTALL test_0.1.tar.gz

Here's an explanation of the mechanism that led to this difference.
You can see the system macro definitions in the file at file.path(R.home(), "share/Rd/macros/system.Rd"). The definition for \PR is
\newcommand{\PR}{\Sexpr[results=rd]{tools:::Rd_expr_PR(#1)}}
The definitions for the others you mention are
\newcommand{\CRANpkg}{\href{https://CRAN.R-project.org/package=#1}{\pkg{#1}}}
\newcommand{\doi}{\Sexpr[results=rd,stage=build]{tools:::Rd_expr_doi("#1")}}
The \CRANpkg macro doesn't execute R code, so it doesn't trigger a package install.
The \doi macro executes code at build time.
Just above the code you linked, you see this test:
needRefman <- manual &&
parse_description_field(desc, "BuildManual", TRUE) &&
any(vapply(db,
function(Rd)
any(getDynamicFlags(Rd)[c("install", "render")]),
NA))
The manual variable defaults to TRUE, but the command line option --no-manual sets it to FALSE. The next part of the test says you can suppress the manual by a field in the DESCRIPTION file.
The getDynamicFlags() function is looking for code in Rd files executed at install or render time, not build time, so the \doi macro doesn't trigger the build of the reference manual.
The \PR macro doesn't specify the stage when it runs, and the documentation seems silent on the default run time, but apparently getDynamicFlags(Rd)[c("install", "render")] returns TRUE for it. I'd guess the default is render time, in case the URL for the bug database changes in some future version of R. [Edit: the docs do say that the default is "install".]
So to suppress this build, put BuildManual: false in the DESCRIPTION file or --no-manual on the R CMD build command line.

Response from R-core on R's Bugzilla:
The \PR macro has initially been used exclusively in R's own NEWS.Rd, where
stage does not really apply.
The stage=install default for Sexpr's probably has historical reasons: build
was implemented later. I agree that stage=build is usually preferable in
non-base packages to avoid blowing up the tarball with the PDF manual. A
partial Rd db is often included anyway because of the \doi macro.
I haven't checked if/how we could modify the PR macro without breaking NEWS.Rd
processing. Note that the macro is mentioned in WRE only as an example for
\newcommand; I don't think it is of general use. It is unclear to which bug
tracker a "PR#" would refer to in the help of a contributed package. It may be
better to simply include the plain URL to a bug report here.
If you'd still like to use it, you could set \RdOpts{stage=build} at the
beginning of the Rd file. (This requires R >= 4.1.0 due to Bug 18073.)

Related

Rpackage, mathjaxr, + check_rhub() returns "Package has help file(s) containing install/render-stage \Sexpr{} expressions but no prebuilt PDF manual"

I'm trying to use the mathjaxr package for my R package documentation. I can locally see the HTML and PDF output of the help file in question and it looks good with mathjaxr::preview_rd("foo", type = "pdf"), pkgdown::build_reference(), etc. However, when I submit my package to devtools::check_rhub(platforms = "windows-x86_64-devel") (or just devtools::check_rhub()), I receive:
* checking CRAN incoming feasibility ... NOTE
Maintainer: 'Name <Email>'
Package has help file(s) containing install/render-stage \Sexpr{} expressions but no prebuilt PDF manual.
I can run R CMD build . and then R CMD check --as-cran mypackage_v.v.v.tar.gz locally and receive Status: OK.
As listed in the mathjaxr documentation I have:
Included mathjaxr in the imports field of the DESCRIPTION file
Included mathjaxr in the RdMacros field of the DESCRIPTION file
Included \loadmathjax in the #description section of each function using mathjaxr
Added #import mathjaxr to the NAMESPACE
This question looks very similar but does not resolve my issue.
Troubleshooting
If I remove everything from the R function's Roxygen skeleton in the relevant .R file except \loadmathjax in the #description section, I still receive the same error. That is, a bare minimum function documentation with just this \loadmathjax macro generates this NOTE.
If I use \loadmathjax{} instead of \loadmathjax, I get the same NOTE.
If I remove \loadmathjax macro but leave everything else (in DESCRIPTION, NAMESPACE, and the \mjtdeqn{}{}{} and \mjeqn{}{} macros in the .R file), I do not receive the NOTE. While I don't expect that my help file will look correct either, I'm not sure how exactly to check this without submitting to CRAN and finding out once accepted.

Creating R package using code from script file

I’ve written some R functions and dropped them into a script file using RStudio. These are bits of code that I use over and over, so I’m wondering how I might most easily create an R package out of them (for my own private use).
I’ve read various “how to” guides online but they’re quite complicated. Can anyone suggest an “idiot’s guide” to doing this please?
I've been involved in creating R packages recently, so I can help you with that. Before proceeding to the steps to be followed, there are some pre-requisites, which include:
RStudio
devtools package (for most of the functions involved in creation of a package)
roxygen2 package (for roxygen documentation)
In case you don't have the aforementioned packages, you can install them with these commands respectively:
install.packages("devtools")
install.packages("roxygen2")
Steps:
(1) Import devtools in RStudio by using library(devtools).
(devtools is a core package that makes creating R packages easier with its tools)
(2) Create your package by using:
create_package("~/directory/package_name") for a custom directory.
or
create_package("package_name") if you want your package to be created in current workspace directory.
(3) Soon after you execute this function, it will open a new RStudio session. You will observe that in the old session some lines will be auto-generated which basically tells R to create a new package with required components in the specified directory.
After this, we are done with this old instance of RStudio. We will continue our work on the new RStudio session window.
By far the package creation part is already over (yes, that simple) however, a package isn't directly functionable just by its creation plus the fact that you need to include a function in it requires some additional aspects of a package such as its documentation (where the function's title, parameters, return types, examples etc as mentioned using #param, #return etc - you would be familiar if you see roxygen documentation like in some github repositories) and R CMD checks to get it working.
I'll get to that in the subsequent steps, but just in case you want to verify that your package is created, you can look at:
The top right corner of the new RStudio session, where you can see the package name that you created.
The console, where you will see that R created a new directory/folder in the path that we specified in create_package() function.
The files panel of RStudio session, where you'll notice a bunch of new files and directories within your directory.
(4) As you mentioned in your words, you drop your functions in a script file - hence you will need to create the script first, which can be done using:
use_r("function_name")
A new R script will pop up in your working session, ready to be used.
Now go ahead and write your function(s) in it.
(5) After your done, you need to load the function(s) you have written for your package. This is accomplished by using the devtools::load_all() function.
When you execute load_all() in the console, you'll get to know that the functions have been loaded into your package when you'll see Loading package_name displayed in console.
You can try calling your functions after that in the console to verify that they work as a part of the package.
(6) Now that your function has been written and loaded into your package, it is time to move onto checks. It is a good practice to check the whole package as we make changes to our package. The function devtools::check() offers an easy way to do this.
Try executing check() in the console, it will go through a number of procedures checking your package for warnings/errors and give details for the same as messages on the screen (pertaining to what are the errors/warnings/notes). The R CMD check results at the end will contain the vital logs for you to see what are the errors and warnings you got along with their frequency.
If the functions in your package are written well, (with additional package dependencies taken care of) it will give you two warnings upon execution of check:
The first warning will be regarding the license that your package uses, which is not specified for a new pacakge.
The second should be the one for documentation, warning us that our code is not documented.
To resolve the first issue which is the license, use the use_mit_license("license_holder_name") command (or any other license which suits your package - but then for private use as you mentioned, it doesn't really matter what you specify if only your going to use it or not its to be distributed) with your name as in place of license_holder_name or anything which suits a license name.
This will add the license field in the .DESCRIPTION file (in your files panel) plus create additional files adding the license information.
Also you'll need to edit the .DESCRIPTION file, which have self-explanatory fields to fill-in or edit. Here is an example of how you can have it:
Package: Your_package_name
Title: Give a brief title
Version: 1.0.0.0
Authors#R:
person(given = "Your_first_name",
family = "Your_surname/family_name",
role = c("package_creator", "author"),
email = "youremailaddress#gmail.com",
comment = c(ORCID = "YOUR-ORCID-ID"))
Description: Give a brief description considering your package functionality.
License: will be updated with whatever license you provide, the above step will take care of this line.
Encoding: UTF-8
LazyData: true
To resolve the documentation warning, you'll need to document your function using roxygen documentation. An example:
#' #param a parameter one
#' #param b parameter two
#' #return sum of a and b
#' #export
#'
#' #examples
#' yourfunction(1,2)
yourfunction <- function(a,b)
{
sum <- a+b
return(sum)
}
Follow the roxygen syntax and add attributes as you desire, some may be optional such as #title for specifying title, while others such as #import are required (must) if your importing from other packages other than base R.
After your done documenting your function(s) using the Roxygen skeleton, we can tell our package that we have documented our functions by running devtools::document(). After you execute the document() command, perform check() again to see if you get any warnings. If you don't, then that means you're good to go. (you won't if you follow the steps)
Lastly, you'll need to install the package, for it to be accessible by R. Simply use the install() command (yes the same one you used at the beginning, except you don't need to specify the package here like install("package") since you are currently working in an instance where the package is loaded and is ready to be deployed/installed) and you'll see after a few lines of installation a statement like "Done (package_name)", which indicates the installation of our package is complete.
Now you can try your function by first importing your package using library("package_name") and then calling your desired function from the package. Thats it, congrats you did it!
I've tried to include the procedure in a lucid way (the way I create my R packages), but if you have any doubts feel free to ask.

How to use other R scripts within my package [duplicate]

I am new to R and I am trying to make a standalone executable so that my scripts can be run without development tools. I have created multiple R scripts containing different functions and have been using a main.r script to connect the other scripts. I have been using RStudio and using Source on each file to add them to the Global Environment and finally using Source on my main file to start executing my program. When attempting to build a binary package through:
Build > Build Binary Package
I was getting the error:
ERROR: The build directory does not contain a DESCRIPTION
file so cannot be built as a package.
So I created a package and now the error I get is
** preparing package for lazy loading
Error in reorderPopulation(pop_fitness_list) :
could not find function "reorderPopulation"
Error : unable to load R code in package 'EAtsp'
ERROR: lazy loading failed for package 'EAtsp'
* removing 'C:/Users/Ryan/AppData/Local/Temp/RtmpsXbv0j/temp_libpath27ec59515c59/EAtsp'
Error: Command failed (1)
Execution halted
Exited with status 1.
Can someone explain to me how to fix this problem?
EDIT: I have since added roxygen comments to each of my functions and they are all displaying within the NAMESPACE file but still have the same issue.
These are the files my R directory contains:
fitness.r
initDataset.r
main.r
operators.r
selection.r
The functions within fitness.r can be found from main.r with no problem so I moved the reorderPopulation function which was previously in selection.r to fitness.r and it can be found. Why can the functions inside the selection.r file and possibly the others not be found?
There's nothing reproducible, so I'll go through a hacked example that works, perhaps you can use it as a template for explaining what is different and why yours should still work.
./DESCRIPTION
Package: Porteous96
Title: This package does nothing
Version: 0.0.0.9000
Authors#R: person('r2evans', email='r2evans#ignore.stackoverflow.com', role=c('aut','cre'))
Description: This package still does nothing
Depends: R (>= 3.3.3)
License: MIT
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.0.1
(Go ahead and try to send an email there ... I don't think it'll bug me ...)
./NAMESPACE
After create:
# Generated by roxygen2: fake comment so roxygen2 overwrites silently.
exportPattern("^[^\\.]")
After document:
# Generated by roxygen2: do not edit by hand
export(reorderPopulation)
(Regardless, this file needs no manually editing, assuming you are either using roxygen2 with its #' #export clause, or you are using the default "export almost everything" without roxygen2.)
./R/reorderPopulation.R
#' Do or do not
#'
#' (There is no try.)
#' #param ... any arguments ultimately ignored
#' #return nothing, invisibly
#' #export
reorderPopulation <- function(...) {
cat("do nothing\n")
invisible(NULL)
}
unorderPopulation <- function(...) {
reorderPopulation()
cat("should not be found\n")
invisible(NULL)
}
./R/zzz.R
I added this file just to try to "find" one of the exported functions from within this package.
.onLoad <- function(libname, pkgname) {
reorderPopulation("ignored", "stuff")
}
I can get away with assuming the function is available, per ?.onLoad:
Note that the code in '.onLoad' and '.onUnload' should not assume
any package except the base package is on the search path.
Objects in the current package will be visible (unless this is
circumvented), but objects from other packages should be imported
or the double colon operator should be used.
Build and Execute
I actually started this endeavor with a template directory created by starting in the intended directory and running:
devtools::create(".")
# Creating package 'Porteous96' in 'C:/Users/r2/Projects/StackOverflow'
# No DESCRIPTION found. Creating with values:
# Package: Porteous96
# Title: What the Package Does (one line, title case)
# Version: 0.0.0.9000
# Authors#R: "My Real Name <myreal##email.address.com> [aut,cre]"
# Description: What the package does (one paragraph).
# Depends: R (>= 3.3.3)
# License: Call for information, please
# Encoding: UTF-8
# LazyData: true
# * Creating `Porteous96.Rproj` from template.
# * Adding `.Rproj.user`, `.Rhistory`, `.RData` to ./.gitignore
However, you can easily just use the samples I provided above and move forward without calling create. (It also includes some other files, e.g., ./.gitignore, ./Porteous96.Rproj, and ./.Rbuildignore, none of which are required in the rest of my process here. If you have them and they have non-default values, that might be good to know.)
From there, I edited/created the above files, then:
devtools::document(".")
# Updating Porteous96 documentation
# Loading Porteous96
# do nothing
# First time using roxygen2. Upgrading automatically...
# Writing NAMESPACE
# Writing reorderPopulation.Rd
(The reason you see "do nothing" above and below is that I put it in a function named .onLoad, triggered each time the library is loaded. This includes during devtools::document and devtools::install as well as the obvious library(Porteous96).
One side-effect of that is that a ./man/ directory is created with the applicable help files. In this case, a single file, reorderPopulation.Rd, no need to show it here.
devtools::install(".")
# Installing Porteous96
# "c:/R/R-3.3.3/bin/x64/R" --no-site-file --no-environ --no-save --no-restore \
# --quiet CMD INSTALL "C:/Users/r2/Projects/StackOverflow/Porteous96" \
# --library="C:/Users/r2/R/win-library/3.3" --install-tests
# * installing *source* package 'Porteous96' ...
# ** R
# ** preparing package for lazy loading
# ** help
# *** installing help indices
# ** building package indices
# ** testing if installed package can be loaded
# *** arch - i386
# do nothing
# *** arch - x64
# do nothing
# * DONE (Porteous96)
# Reloading installed Porteous96
# do nothing
For good measure, I close R and re-open it. (Generally unnecessary.)
library(Porteous96)
# do nothing
(Again, this is dumped to the console because of .onLoad.)
reorderPopulation()
# do nothing
unorderPopulation()
# Error: could not find function "unorderPopulation"
Porteous96:::unorderPopulation()
# do nothing
# should not be found
Wrap-Up
I'm guessing this does not solve your problem. It highlights about as much as I could glean from your question(s). Perhaps it provides enough framework where you can mention salient differences between my files and yours. Though answers are not meant for pre-solution discussion, I think it is sometimes necessary and useful.
After help from #r2evans I have managed to find a solution to the problem.
My main.r file was just a bunch of function calls with no function wrapping them. So I wrapped the function calls in a function and the function now looks as follows:
mainFunction <- function() {
source("R/initSetup.r")
initSetup()
...
}
initSetup.r contains more source() calls to the other files that I use. The program is then run using the command mainFunction() in the R console

Building binary package R

I am new to R and I am trying to make a standalone executable so that my scripts can be run without development tools. I have created multiple R scripts containing different functions and have been using a main.r script to connect the other scripts. I have been using RStudio and using Source on each file to add them to the Global Environment and finally using Source on my main file to start executing my program. When attempting to build a binary package through:
Build > Build Binary Package
I was getting the error:
ERROR: The build directory does not contain a DESCRIPTION
file so cannot be built as a package.
So I created a package and now the error I get is
** preparing package for lazy loading
Error in reorderPopulation(pop_fitness_list) :
could not find function "reorderPopulation"
Error : unable to load R code in package 'EAtsp'
ERROR: lazy loading failed for package 'EAtsp'
* removing 'C:/Users/Ryan/AppData/Local/Temp/RtmpsXbv0j/temp_libpath27ec59515c59/EAtsp'
Error: Command failed (1)
Execution halted
Exited with status 1.
Can someone explain to me how to fix this problem?
EDIT: I have since added roxygen comments to each of my functions and they are all displaying within the NAMESPACE file but still have the same issue.
These are the files my R directory contains:
fitness.r
initDataset.r
main.r
operators.r
selection.r
The functions within fitness.r can be found from main.r with no problem so I moved the reorderPopulation function which was previously in selection.r to fitness.r and it can be found. Why can the functions inside the selection.r file and possibly the others not be found?
There's nothing reproducible, so I'll go through a hacked example that works, perhaps you can use it as a template for explaining what is different and why yours should still work.
./DESCRIPTION
Package: Porteous96
Title: This package does nothing
Version: 0.0.0.9000
Authors#R: person('r2evans', email='r2evans#ignore.stackoverflow.com', role=c('aut','cre'))
Description: This package still does nothing
Depends: R (>= 3.3.3)
License: MIT
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.0.1
(Go ahead and try to send an email there ... I don't think it'll bug me ...)
./NAMESPACE
After create:
# Generated by roxygen2: fake comment so roxygen2 overwrites silently.
exportPattern("^[^\\.]")
After document:
# Generated by roxygen2: do not edit by hand
export(reorderPopulation)
(Regardless, this file needs no manually editing, assuming you are either using roxygen2 with its #' #export clause, or you are using the default "export almost everything" without roxygen2.)
./R/reorderPopulation.R
#' Do or do not
#'
#' (There is no try.)
#' #param ... any arguments ultimately ignored
#' #return nothing, invisibly
#' #export
reorderPopulation <- function(...) {
cat("do nothing\n")
invisible(NULL)
}
unorderPopulation <- function(...) {
reorderPopulation()
cat("should not be found\n")
invisible(NULL)
}
./R/zzz.R
I added this file just to try to "find" one of the exported functions from within this package.
.onLoad <- function(libname, pkgname) {
reorderPopulation("ignored", "stuff")
}
I can get away with assuming the function is available, per ?.onLoad:
Note that the code in '.onLoad' and '.onUnload' should not assume
any package except the base package is on the search path.
Objects in the current package will be visible (unless this is
circumvented), but objects from other packages should be imported
or the double colon operator should be used.
Build and Execute
I actually started this endeavor with a template directory created by starting in the intended directory and running:
devtools::create(".")
# Creating package 'Porteous96' in 'C:/Users/r2/Projects/StackOverflow'
# No DESCRIPTION found. Creating with values:
# Package: Porteous96
# Title: What the Package Does (one line, title case)
# Version: 0.0.0.9000
# Authors#R: "My Real Name <myreal##email.address.com> [aut,cre]"
# Description: What the package does (one paragraph).
# Depends: R (>= 3.3.3)
# License: Call for information, please
# Encoding: UTF-8
# LazyData: true
# * Creating `Porteous96.Rproj` from template.
# * Adding `.Rproj.user`, `.Rhistory`, `.RData` to ./.gitignore
However, you can easily just use the samples I provided above and move forward without calling create. (It also includes some other files, e.g., ./.gitignore, ./Porteous96.Rproj, and ./.Rbuildignore, none of which are required in the rest of my process here. If you have them and they have non-default values, that might be good to know.)
From there, I edited/created the above files, then:
devtools::document(".")
# Updating Porteous96 documentation
# Loading Porteous96
# do nothing
# First time using roxygen2. Upgrading automatically...
# Writing NAMESPACE
# Writing reorderPopulation.Rd
(The reason you see "do nothing" above and below is that I put it in a function named .onLoad, triggered each time the library is loaded. This includes during devtools::document and devtools::install as well as the obvious library(Porteous96).
One side-effect of that is that a ./man/ directory is created with the applicable help files. In this case, a single file, reorderPopulation.Rd, no need to show it here.
devtools::install(".")
# Installing Porteous96
# "c:/R/R-3.3.3/bin/x64/R" --no-site-file --no-environ --no-save --no-restore \
# --quiet CMD INSTALL "C:/Users/r2/Projects/StackOverflow/Porteous96" \
# --library="C:/Users/r2/R/win-library/3.3" --install-tests
# * installing *source* package 'Porteous96' ...
# ** R
# ** preparing package for lazy loading
# ** help
# *** installing help indices
# ** building package indices
# ** testing if installed package can be loaded
# *** arch - i386
# do nothing
# *** arch - x64
# do nothing
# * DONE (Porteous96)
# Reloading installed Porteous96
# do nothing
For good measure, I close R and re-open it. (Generally unnecessary.)
library(Porteous96)
# do nothing
(Again, this is dumped to the console because of .onLoad.)
reorderPopulation()
# do nothing
unorderPopulation()
# Error: could not find function "unorderPopulation"
Porteous96:::unorderPopulation()
# do nothing
# should not be found
Wrap-Up
I'm guessing this does not solve your problem. It highlights about as much as I could glean from your question(s). Perhaps it provides enough framework where you can mention salient differences between my files and yours. Though answers are not meant for pre-solution discussion, I think it is sometimes necessary and useful.
After help from #r2evans I have managed to find a solution to the problem.
My main.r file was just a bunch of function calls with no function wrapping them. So I wrapped the function calls in a function and the function now looks as follows:
mainFunction <- function() {
source("R/initSetup.r")
initSetup()
...
}
initSetup.r contains more source() calls to the other files that I use. The program is then run using the command mainFunction() in the R console

non-evaluated vignettes with knitr::rmarkdown_notangle

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.

Resources