-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
don't allow the use of targets made available by create_bindings() during knitting #174
Comments
Can you please be more specific? |
With foo <- function() {
runif(1)
}
render <- function(f, ...) {
rmarkdown::render(f, ...)
} with ---
title: test
---
The random number is `r target1`. with sources:
- test.R
targets:
all:
depends: manuscript.pdf
target1:
command: foo()
manuscript.md:
knitr: true
manuscript.pdf:
command: render("manuscript.md", output_format=I("pdf_document")) The first time we attempt to generate the manuscript, it will fail as expected. The target > make()
[ LOAD ]
[ READ ] | # loading sources
< MAKE > all
[ KNIT ] manuscript.md | knitr::knit("manuscript.Rmd", "manuscript.md")
[ READ ] | # loading packages
Quitting from lines 2-5 (manuscript.Rmd)
Restoring previous version of manuscript.md
Error in eval(parse_only(code[i]), envir = envir) :
object 'target1' not found Realistically, in a large project, at some point, I will have created > make("target1")
< MAKE > target1
[ BUILD ] target1 | target1 <- foo() At this point, if I try to build the manuscript, it will still fail (the target has been built, but the manuscript doesn't explicitly depend on it): > make()
< MAKE > all
[ KNIT ] manuscript.md | knitr::knit("manuscript.Rmd", "manuscript.md")
Quitting from lines 2-5 (manuscript.Rmd)
Restoring previous version of manuscript.md
Error in eval(parse_only(code[i]), envir = envir) :
object 'target1' not found If I use > create_bindings()
> make()
< MAKE > all
[ KNIT ] manuscript.md | knitr::knit("manuscript.Rmd", "manuscript.md")
[ BUILD ] manuscript.pdf | render("manuscript.md", output_format = "pdf_doc...
/usr/bin/pandoc +RTS -K512m -RTS manuscript.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output manuscript.pdf --template /home/francois/.R/library/rmarkdown/rmd/latex/default-1.17.0.2.tex --highlight-style tango --latex-engine pdflatex --variable graphics=yes --variable 'geometry:margin=1in'
Output created: manuscript.pdf
[ ----- ] all |
I don't know if it's technically possible, but I noticed that if I knit a manuscript after invoking
create_bindings()
, then it will use the target in memory even if they are not explicitly listed as dependencies of the manuscript.The text was updated successfully, but these errors were encountered: