Skip to content

Commit

Permalink
the argument error of include_graphics() takes value from the glo…
Browse files Browse the repository at this point in the history
…bal R option `knitr.graphics.error` by default

#1717 (comment)
  • Loading branch information
yihui committed Feb 7, 2020
1 parent 2708e51 commit 6daea79
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGES IN knitr VERSION 1.29

## NEW FEATURES

- The argument `error` of `include_graphics()` takes value from the global R option `knitr.graphics.error` by default, e.g., you may set `options(knitr.graphics.error = FALSE)` so `include_graphics()` won't signal an error if the graphics file to be included doesn't exist.

# CHANGES IN knitr VERSION 1.28

Expand Down
2 changes: 1 addition & 1 deletion R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ par2 = function(x) {
#' @export
include_graphics = function(
path, auto_pdf = getOption('knitr.graphics.auto_pdf', FALSE), dpi = NULL,
error = TRUE
error = getOption('knitr.graphics.error', TRUE)
) {
path = native_encode(path) # https://d.cosx.org/d/420524
if (auto_pdf && is_latex_output()) {
Expand Down
2 changes: 1 addition & 1 deletion man/include_graphics.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6daea79

Please sign in to comment.