Skip to content

Releases: yihui/knitr

CHANGES IN knitr VERSION 0.3

25 May 21:34
Compare
Choose a tag to compare

NEW FEATURES

  • a fundamental and important new feature for writing chunk options: they can be written as valid R code now, just like we write function arguments (e.g. echo=c(1, 3, 5), fig.cap="my figure caption"); all options will be parsed and evaluated as R code by default; see http://yihui.name/knitr/options for details (#142) (thanks, Baptiste Auguie)
  • chunk references using <<label>> is supported now (#86); thanks to Kevin R. Coombe and Terry Therneau for the discussion
  • new function run_chunk() to run the code in a specified chunk, which is an alternative to the chunk reference in Sweave; see http://yihui.name/knitr/demo/reference/
  • a executable script knit under system.files('bin', package = 'knitr') which makes it easier to call knitr via command line under *nix (call knit input [output] [--pdf])
  • the inline hooks respect getOption('digits') and getOption('scipen') now (see ?options); numbers returned from inline R code will be formatted according to these two options (see a demo at http://yihui.name/knitr/demo/output/)
  • if you still use old Sweave syntax for chunk options, it is possible to write literal commas in chunk options now -- they have to be escaped by \, e.g. caption=hello\, world; this will be parsed to 'hello, world' as a character string; of course this looks ugly and has limited power, so please please consider the new syntax!
  • knit2pdf() gained another argument compiler which can be used to specify the program to compile the tex document to PDF, such as xelatex (#131) (thanks, Ramnath Vaidyanathan and Dennis Murphy)
  • a new function imgur_upload() to upload images to imgur.com; it can be used in HTML or Markdown hooks so the output is a self-contained document which does not need additional image files; opts_knit$get('upload.fun') can use this function (#66) (thanks, Ramnath Vaidyanathan)
  • a child document can be compiled individually with the LaTeX preamble borrowed automatically from a parent document using a new function set_parent(); see the help page for details (#136) (thanks, Helder Correia)
  • to avoid $$ around numbers in the inline output, we can use I() to protect the numeric inline output, e.g. $x = \Sexpr{I(10^7)}$ gives $x = 10^7$ whereas \Sexpr{10^7} gives $10^7$ (thanks, Kevin Middleton)
  • the listings package is formally supported now (see ?render_listings); the default style is borrowed from Sweavel.sty written by Frank Harrell (#101) (thanks, Frank)
  • new package option cache.extra which allows more objects to affect cache; see http://yihui.name/knitr/demo/cache/ (#134)
  • new package option child.path to specify the search path of child documents relative to the parent document (#141)
  • new package option aliases to set aliases for chunk options; see http://yihui.name/knitr/options (#144)
  • new chunk options fig.cap, fig.scap and fig.lp to write captions, short captions, label prefix for the figure environment in LaTeX (#145) (thanks, Frank Harrell)
  • new package option eval.after to set a character vector of chunk options which should be evaluated after a chunk is executed (thanks, Frank Harrell)
  • a series of convenience functions pat_rnw(), pat_tex(), pat_brew() and pat_html() to set built-in patterns (syntax) to read input

MINOR CHANGES

  • package option eval.opts has been dropped: all options of classes symbol or language will be evaluated, so there is no need to specify which options to evaluate manually; remember, the chunk options are similar to function arguments, so you can use any valid R code there
  • the default value for the output argument in knit() is NULL now, so we can also provide output filenames to stitch() and knit2pdf() (#119)
  • standard LaTeX messages are suppressed when a tikz plot is compiled to PDF so that we can see the knitr process more clearly
  • %\SweaveInput{} will be ignored now (#150)
  • results=asis will no longer affect the chunk hook (in the past, the chunk output was not wrapped in the kframe environment when results=asis); it only affects the output hook now
  • the package website allows comments now

MAJOR CHANGES

  • the starting pattern of normal texts in an Rnw document is ^@\\s*%* instead of ^@\\s*$ now, meaning you can write @ % a comment to end a code chunk (this is consistent with Sweave)
  • the default value of the argument output of knit() will be a filename under the current working directory; in previous versions, the output file will be under the same directory as the input file; this change makes it possible to completely separate the input files and output files into different places, and hopefully will give users better experience in managing a whole collection of files (including child documents): put all source files in one place and output files in another place
  • the package homepage is http://yihui.name/knitr now (the previous URL yihui.github.com/knitr will be automatically redirected to the new address)

BUG FIXES

  • the object opts_current does not give the evaluated version of the current chunk options because it was created before the options are evaluated; this has been fixed and opts_current$get() will give the expected values of options (thanks, Frank Harrell)

MISC

  • number of downloads (https://github.com/yihui/knitr/downloads) of knitr documentation before I removed and updated them on GitHub: c(main = 1300, graphics = 549, themes = 130, beamer = 565, listings = 240, minimal = 160)

CHANGES IN knitr VERSION 0.2

25 May 21:34
Compare
Choose a tag to compare

NEW FEATURES

  • added support for including child documents in a main document (like \SweaveInput{} but with different implementations); see http://yihui.name/knitr/demo/child/ (#92)
  • for inline R code, character results are returned as-is now (without \texttt{})
  • new function purl() as a wrapper to knit(..., tangle = TRUE) which extracts R code from the input document (thanks to Dieter Menne's wife who suggested the function name)
  • the error hook applies to inline R code when an error occurs in the inline R code, in which case knitr will not stop by default; instead, it writes the error message into the output (#85)
  • chunk option split also works for HTML output now using <iframe></iframe> (#82)
  • knit() gained an argument text as an alternative to input (#88)
  • new chunk option child to include child documents into the main document (#92)
  • chunk option external defaults to TRUE now (was FALSE by default in the last version)
  • added a new demo to show how to build package vignettes with knitr: http://yihui.name/knitr/demo/vignette/
  • added support to the quartz() device under Mac (#103); now the dev option has more choices (see http://yihui.name/knitr/options)
  • chunk option echo can take a numeric vector to select which R expressions to echo into the output now (#108); see http://yihui.name/knitr/options
  • a new function stitch() which is a convenience function to insert an R script into a template and compile (to quickly create a report
    based on an R script)
  • for a chunk hook to run, the corresponding chunk option no longer has to be TRUE; it can be any non-null values; this enables us to make use of the option value directly instead of only knowing it is TRUE (see http://yihui.name/knitr/demo/cache/ for an example)
  • knit() will no longer writes figure or cache files in the same directory as the input document; instead, these files are written in the current working directory (see ?knit)
  • a new function knit_env() that makes the environment of the current chunk accessible to the user

BUG FIXES

  • the code used to merge global chunk options and local options was buggy for cache; it has been fixed now, so cache is more stable (#105), but users may see previously cached chunks being re-evaluated with this version, which should be regarded as a normal phenomenon, and on the second run, the cached chunks will not be evaluated again
  • fixed a buglet when using both options out.width and out.height in Rnw (#113)

CHANGES IN knitr VERSION 0.1

25 May 21:35
Compare
Choose a tag to compare

NEW FEATURES

  • first version of knitr: it covers most features in Sweave, cacheSweave and pgfSweave; see package homepage for documentation and examples: http://yihui.name/knitr/

MISC

  • knitr won an Honorable Mention prize (before it was formally released to CRAN) in the Applications of R in Business Contest hosted by Revolution Analytics: http://bit.ly/wP1Dii http://bit.ly/wDRCPV
  • in this NEWS file, #n means the issue number on GitHub, e.g. #142 is #142