Skip to content


Subversion checkout URL

You can clone with
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

369 lines (269 sloc) 14.962 kB
o white spaces are allowed before <<>> when using chunk references,
and this approach of references is supported in tex and html
documents as well
o added a new pattern list named 'gfm' so that R code blocks can be
written more naturally in GFM and pandoc (use ``` {r label, opts} to
begin a chunk and ```` to end a chunk); call pat_gfm() before knit()
so knitr can make use of this pattern list to process the input
o if the pattern list is not set in advance, knitr will try to
detect the syntax automatically by matching all built-in pattern
lists against the input document, e.g. if the input contains <<>>=,
the Rnw syntax will be used; this feature enables us to use
different sets of syntax freely, e.g. we can use Sweave syntax in
markdown files and knitr will be able to recognize it (#189)
o the chunk option fig.cap is also used in markdown output now
o the random seed .Random.seed is also cached for the sake of
reprodubibility in random simulations
o the function call read_chunk() will be evaluated when tangling R
code via purl() (#175) (thanks, Carl Boettiger)
o knitr will completely stop when duplicated labels are found and
the corresponding chunks are non-empty; in previous version, only a
warning is given and R code in later chunks will override previous
chunks (#185) (thanks, Randall Pruim)
o the compilation of tikz graphics can hang up when there are TeX
errors in the tikz file; now we use \nonstopmode to avoid hiccup
o Sweave concordance was finally implemented: when
opts_knit$get('concordance') is TRUE, knitr will write a file named
'input-concordance.tex' which contains the mapping between input Rnw
and output tex line numbers; this feature is mainly for (but not
limited to) RStudio to provide better error navigations: you can
jump from the TeX error message to the Rnw source directly to know
where the error comes from (the line number of the source of the
error may not be accurate but should be in the ballpark) (#133)
(thanks, JJ Allaire and Joe Cheng)
o if output hooks have been set before calling knit(), they will be
respected, i.e. knitr will no longer override them by default hooks;
you need to make sure *all* output hooks are set appropriately,
e.g. you can start by render_latex() and change some individual
hooks later (#165) (thanks, Andrew Redd)
o newly created objects in the global environment will also be
cached if cache is turned on (cache=TRUE); in previous versions
knitr is unaware of objects created in globalenv(),
e.g. setGeneric() creates S4 generic functions in globalenv() and
knitr was unable to capture them (#138) (thanks, syoh)
o chunk options dev, fig.ext and dpi can be vectors now; this allows
one to save a plot to multiple formats, e.g. <<foo, dev=c('pdf',
'png')>>= creates two files for the same plot: foo.pdf and foo.png
(#168) (thanks, MYaseen208)
o an experimental feature for animations created by FFmpeg in
HTML/markdown output when'animate' (#166) (thanks,
o the chunk option 'fig.cap' supports multiple figure captions in
LaTeX now, e.g. if a chunk produces two plots, we can use fig.cap =
c('first caption', 'second caption') to assign two different
captions to them respectively when = 'asis' (#155) (thanks,
Jonathan Kennel)
o new package option opts_knit$get('') which is a function
that takes a plot file to upload to a certain host and returns the
link to the image; by default it is imgur_upload(), and you can use
your own function to upload images to other hosts like Flickr (#159)
(thanks, Carl Boettiger)
o all packages loaded in the current session are also cached, so as
long as a package has been loaded previously, it will be available
to all following chunks (#160)
o new chunk option 'autodep' and function build_dep() to build cache
dependencies among cached chunks automatically by analyzing object
names in all cached chunks; this is a loose alternative to the
'dependson' option (see main manual and ?build_dep for details)
(#72) (thanks, Seth Falcon)
o input and output in knit() are no longer restricted to files; they
can be stdin()/stdout() or other types of connections (#162; see (thanks, gabysbrain)
o as-is output (results='asis') and plots are no longer put in the
framed environments because of incompatibilities (#163) (thanks,
DCCKC, Murray Logan and Jennym Hutchison)
o for plots in LaTeX output, centering should be done with
{\centering } instead of \centering{} (#156) (thanks, Ramnath
o the recorded plot is a more precise representation of the expected
plot now, because the recording device also takes the plot size into
consideration (#157) (thanks, Christiaan Klijn and Frank Harrell)
o format_sci() now correctly formats 0; this function is used for
inline R code to format numbers in scientific notation (#161)
(thanks, Kihoro J. M.)
o fixed a bug for the case in which the chunk option only contains
the label like <<label=foobar>>=; knitr 0.3 was unable to parse the
label correctly (<<foobar>>= is OK) (thanks, Muhammad Yaseen)
o imgur_upload() returns the link to the image directly, with the
XML list as its attribute (in v0.3 the list was returned)
o more verbose messages in case of chunk errors: both line numbers
of the source and chunk info will be printed
o website updated as usual:
o added an example for subfloat environment:
o most manuals (main or graphics manuals) have been updated
o number of downloads ( of
knitr documentation before I removed and updated them on GitHub:
c(main = 400, graphics = 177)
o 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 for details (#142) (thanks, Baptiste
o chunk references using <<label>> is supported now (#86); thanks to
Kevin R. Coombe and Terry Therneau for the discussion
o new function run_chunk() to run the code in a specified chunk,
which is an alternative to the chunk reference in Sweave; see
o 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]')
o 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
o 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!
o 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)
o a new function imgur_upload() to upload images to; 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('') can use this function (#66) (thanks,
Ramnath Vaidyanathan)
o 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)
o 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
o 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)
o new package option 'cache.extra' which allows more objects to
affect cache; see (#134)
o new package option 'child.path' to specify the search path of
child documents relative to the parent document (#141)
o new package option 'aliases' to set aliases for chunk options; see (#144)
o 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)
o 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)
o a series of convenience functions pat_rnw(), pat_tex(), pat_brew()
and pat_html() to set built-in patterns (syntax) to read input
o 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
o the default value for the 'output' argument in knit() is NULL now,
so we can also provide output filenames to stitch() and knit2pdf()
o standard LaTeX messages are suppressed when a tikz plot is
compiled to PDF so that we can see the knitr process more clearly
o %\SweaveInput{} will be ignored now (#150)
o 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
o the package website allows comments now
o 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)
o 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
o the package homepage is now (the previous
URL will be automatically redirected to the
new address)
o 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)
o number of 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)
o added support for including child documents in a main document
(like \SweaveInput{} but with different implementations); see (#92)
o for inline R code, character results are returned as-is now
(without \texttt{})
o 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)
o 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)
o chunk option 'split' also works for HTML output now using
'<iframe></iframe>' (#82)
o knit() gained an argument `text` as an alternative to 'input'
o new chunk option 'child' to include child documents into the main
document (#92)
o chunk option 'external' defaults to TRUE now (was FALSE by default
in the last version)
o added a new demo to show how to build package vignettes with
o added support to the quartz() device under Mac (#103); now the
'dev' option has more choices (see
o chunk option 'echo' can take a numeric vector to select which R
expressions to echo into the output now (#108); see
o 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)
o 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 for an example)
o 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)
o a new function knit_env() that makes the environment of the
current chunk accessible to the user
o 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
o fixed a buglet when using both options 'out.width' and
'out.height' in Rnw (#113)
o first version of knitr: it covers most features in Sweave,
cacheSweave and pgfSweave; see package homepage for documentation
and examples:
o 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:
o in this NEWS file, #n means the issue number on GitHub, e.g. #142
Jump to Line
Something went wrong with that request. Please try again.