Closed jnolis closed 10 years ago
Can you elaborate a bit on what you mean by 'for use with knitr'? What do you get if you call packrat:::fileDependencies
on those files individually -- do you get a more informative error / warning?
I'm not sure about the error / warnings, but I'll investigate.
The .Rnw files we make are compiled using the command:
knit(".../report_A.Rnw", ".../report_A.tex")
When I run packrat:::fileDependencies
on one of the files I get the same error as before:
Unable to stangle file '.../report_A.Rnw'; cannot parse dependencies
I highly suspect it's because line 117 of dependencies.R assumes that, since it's a .Rnw file, to determine what the dependencies of the file are it should be treated as though the file is compiled with the Stangle
command (and not the knit
command). The Stangle
command on line 121 fails as the file isn't compatible with sweave. In fact the code to correctly determine the dependencies for this file is essentially already in dependencies.R since it's used for .Rmd files created from knitr (lines 100-115). If that code is taken and used on .Rnw files as well it should work for me. You probably want to do something like "if Stangle fails on an .Rnw try knit on it, otherwise error."
In fact the particular Stangle
call fails because I get:
Error in match.arg(options$results, c("verbatim", "tex", "hide")) : 'arg' should be one of “verbatim”, “tex”, “hide”
Which I think is due to the fact that Knitr .Rmw files have more options than sweave .Rnw files.
That would be it indeed. Thanks for investigating.
This PR does what you are suggesting: https://github.com/rstudio/packrat/pull/86
The PR has been merged, and both knitr
and Sweave
are tried when parsing dependencies now.
When I run packrat::bootstrap() for the first time in my project I get the following:
It looks like this might have to do with the fact that the Rnw files I have are were made for use with knitr and not sweave. That explains why the stangle call fails, but I am not sure why that causes the error down the line (if that is even related).