Skip to content

CHANGES IN knitr VERSION 1.15

Compare
Choose a tag to compare
@yihui yihui released this 09 Nov 17:51
· 1146 commits to master since this release

NEW FEATURES

  • NA values can be displayed using different characters (including empty strings) in kable(); you can set the option knitr.kable.NA, e.g. options(knitr.kable.NA = '') to hide NA values (#1283)
  • added a fortran95 engine (thanks, @stefanedwards, #1282)
  • added a block2 engine for R Markdown documents as an alternative to the block engine; it should be faster and supports arbitrary Pandoc's Markdown syntax, but it is essentially a hack; note when the output format is LaTeX/PDF, you have to define \let\BeginKnitrBlock\begin \let\EndKnitrBlock\end in the LaTeX preamble
  • figure captions specified in the chunk option fig.cap are also applied to HTML widgets (thanks, @byzheng, rstudio/bookdown#118)
  • when the chunk option fig.show = 'animate' and ffmpeg.format = 'gif', a GIF animation of the plots in the chunk will be generated for HTML output (https://twitter.com/thomasp85/status/785800003436421120)
  • added a width argument to write_bib() so long lines in bib entries can be wrapped
  • the inline syntax `r#code` is also supported besides `r code`; this can make sure the inline expression is not split when the line is wrapped (thanks, Dave Jarvis)
  • provided a global R option knitr.use.cwd so users can choose to evaluate the R code chunks in the current working directory after setting options(knitr.use.cwd = TRUE); the default is to evaluate code in the directory of the input document, unless the knitr option opts_knit$set(root.dir = ...) has been set
  • if options(knitr.digits.signif = TRUE), numbers from inline expressions will be formatted using getOption('digits') as the number of significant digits, otherwise (the default behavior) getOption('digits') is treated as the number of decimal places (thanks, @numatt, #1053)
  • the chunk option engine.path can also be a list of paths to the engine executables now, e.g., you can set knitr::opts_chunk$set(engine.path = list(python = '/anaconda/bin/python', perl = '/usr/local/bin/perl')), then when a python code chunk is executed, /anaconda/bin/python will be called instead of the system default (rstudio/rmarkdown#812)
  • introduced a mechanism to protect text output in the sense that it will not be touched by Pandoc during the conversion from R Markdown to another format; this is primarily for package developers to extend R Markdown; see ?raw_output for details (which also shows new functions extract_raw_output() and restore_raw_output())

MAJOR CHANGES

  • the minimal version of R required for knitr is 3.1.0 now (#1269)
  • the formatR package is an optional package since the default chunk option tidy = FALSE has been there for a long time; if you use tidy = TRUE, you need to install formatR separately if it is not installed
  • :set +m is no longer automatically added to haskell code chunks (#1274)

MINOR CHANGES

  • the package option opts_knit$get('stop_on_error') has been removed
  • the confusing warning message about knitr::knit2html() when buiding package vignettes using the knitr::rmarkdown engine without pandoc/pandoc-citeproc has been removed (#1286)
  • the default value of the quiet argument of plot_crop() was changed from !opts_knit$get('progress') to TRUE, i.e., by default the messages from cropping images are suppressed

BUG FIXES

  • the chunk option cache.vars did not really behave like what was documented (thanks, @simonKTH, #1280)
  • asis_output() should not be merged with normal character output when results='hold' (thanks, @kevinushey, #1310)