Pkg creation: Sweave: multiple files vignette: Error in R CMD check
My guess is that your child Rnw file was not copied to inst/doc during R CMD build or check. You may read the section 1.4 of the R-exts manual: http://cran.rstudio.com/doc/manuals/r-release/R-exts.html#Writing-package-vignettes
When R CMD build builds the vignettes, it copies these and the vignette sources from directory vignettes to inst/doc. To install any other files from the vignettes directory, include a file vignettes/.install_extras which specifies these as Perl-like regular expressions on one or more lines. (See the description of the .Rinstignore file for full details.)
So it seems you will need a .install_extras file to make sure the child Rnw file is copied along with the parent .Rnw. I do not think you have to obfuscate the path of the child Rnw file like ../../whatever/... but you do have to change its file extension if and only if you put it under the root directory vignettes/ (it should be fine if it is under a sub directory). Regards, Yihui -- Yihui Xie <xieyihui at gmail.com> Web: http://yihui.name
On Thu, Nov 6, 2014 at 8:44 AM, <rolandh at uni-muenster.de> wrote:
Hello R-developers!
First I want to thank Duncan, Sean and Ben (off-list-communication) for your
comments and suggestions!
Unfortunetly the renaming of the child.Rnw file to e.g. child.sub and also the
usage of an other file type like child.txt did not solve the Problem.
I got an ERROR in the beginning of the check process:
###
...
** installing vignettes
?Master.Rnw? using ?UTF-8?
Error in SweaveReadFile(c(ifile, file), syntax, encoding = encoding) :
no Sweave file with name ?./TitlePage.sub? found
ERROR: installing vignettes failed
* removing ?/tmp/Rtmp1iHmcw/Rinst1bc110488fde/trajaggr?
-----------------------------------
ERROR: package installation failed
###
I found a workaround which passes the "installing vignettes" process. In this
workaround the child.Rnw file (here: TitlePage.Rnw) is placed in a subfolder
of the vignettes folder and \SweaveInput{} in the Master.Rnw-file looks like
this:
...
\SweaveInput{../../../../../../../../home/harry/.../R/R_wd/myPkg/.../vignettes/TitlePage/TitlePage.Rnw}
..
(By the way I do not see the difference between this and the original approach
with \SweaveInput{TitlePage/TitlePage.Rnw})
Unfortunetly there is still an issue related to this workaround!
I got a NOTE related to "checking re-building of vignette outputs" in the end
of the check process:
###
* checking running R code from vignettes ...
?Master.Rnw? using ?UTF-8? ... OK
OK
* checking re-building of vignette outputs ... NOTE
Error in re-building vignettes:
...
Fehler: Verarbeitung der Vignette 'Master.Rnw' mit folgender Diagnose
fehlgeschlagen:
no Sweave file with name
?./../../../../../../../../../home/harry/.../R/R_wd/myPkg/.../vignettes/TitlePage/TitlePage.Rnw?
found
###
[This workaround idea came from:
http://r.789695.n4.nabble.com/Sweave-absolute-path-versus-relative-path-td3950135.html]
I am a newbie related to package creation and I am confused why the Sweave
file now is found in the beginning (original problem) but not in the end (new
NOTE in R CMD check)?
It seems to be a path problem. Is the "checking re-building of vignette
outputs" done out of another origin/ folder, e.g. like out of a temporal
created package source and / or out of /inst/doc? If it is like that this NOTE
seems to be unsolvable!?!
Any suggestions what to do to solve this?
Thank you very much again!
Cheers!
Roland
Duncan Murdoch schrieb am 2014-11-04:
On 03/11/2014, 4:08 PM, rolandh at uni-muenster.de wrote:
Hello R-developers!
I am creating a package (using devtools and RStudio) and I would like to split my vignette into multiple Rnw-files.
As an example I tried the code from: https://support.rstudio.com/hc/en-us/articles/200486298 (--> Working with multiple Rnw files)
The Rnw-files work fine with "Complie pdf" in RStudio as well as
with
Sweave("Master.Rnw").
But, if I try to check my package I get the following error:
...
* creating vignettes ... ERROR
Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet =
quiet, :
Ausf?hren von 'texi2dvi' f?r 'ChapterY.tex' fehlgeschlagen.
LaTeX errors:
! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... ! Emergency stop. <*> ...13 \let~\normaltilde \input ./ChapterY.tex
*** (job aborted, no legal \end found)
! ==> Fatal error occurred, no output PDF file produced! Calls: <Anonymous> -> texi2pdf -> texi2dvi Ausf?hrung angehalten Fehler: Command failed (1) Ausf?hrung angehalten
Exited with status 1. ###
So, it seems like that it is tried to make a tex-file from my child-Rnw-file called "ChapterY.Rnw", what of couse is not possible, because that file contains no praeambel.
As a workaround I tried to put my child-Rnw-file in a subfolder
(ChapterY) and
calling this file by
\SweaveInput{ChapterY/ChapterY.Rnw}.
Again, "Complie pdf" as well as Sweave("Master.Rnw") works fine,
but with
checking the package
I get the following error:
Error in SweaveReadFile(c(ifile, file), syntax, encoding = encoding) : no Sweave file with name ?./ChapterY/ChapterY.Rnw? found ERROR: installing vignettes failed
By the way I tried that on different (L)ubuntu machines (12.04, 14) which the latest version of RStudio and R, and I also tried it after updating texlive to version 2012, always getting the same error.
Moreover, if I just use one Rnw-file instaed of multiple files checking the package finished fine without errors!
I do not know what to do anymore, and I did not find any solution in the www ...
Do someone has any idea how to solve this problem in any way?
Thank you very very much in advance!
I suspect the problem is that the check code can't tell which is the main file, and which ones are the sub files. Have you tried naming the sub files something else, e.g. chapter.sub?
Duncan Murdoch
Greetings!
Roland
### R version 3.1.2 (2014-10-31) Platform: i686-pc-linux-gnu (32-bit)
locale: [1] LC_CTYPE=de_DE.UTF-8 LC_NUMERIC=C LC_TIME=de_DE.UTF-8 LC_COLLATE=de_DE.UTF-8 [5] LC_MONETARY=de_DE.UTF-8 LC_MESSAGES=de_DE.UTF-8 LC_PAPER=de_DE.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] trajcoert01_0.1
loaded via a namespace (and not attached): [1] devtools_1.6 geosphere_1.3-8 grid_3.1.2 intervals_0.14.0 lattice_0.20-29 [6] move_1.2.475 raster_2.2-31 rgdal_0.8-16 rgeos_0.3-4 sp_1.0-15 [11] spacetime_1.1-2 tools_3.1.2 trajectories_0.1-1 xts_0.9-7 zoo_1.7-11 ###
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel