Render multiple R Markdown files under the current working directory into a
book. It can be used in the RStudio IDE (specifically, the knit
field
in YAML). The preview_chapter()
function is a wrapper of
render_book(preview = TRUE)
.
render_book(input, output_format = NULL, ..., clean = TRUE, envir = parent.frame(),
clean_envir = !interactive(), output_dir = NULL, new_session = NA, preview = FALSE,
encoding = "UTF-8", config_file = "_bookdown.yml")preview_chapter(..., envir = parent.frame())
An input filename (or multiple filenames). If preview =
TRUE
, only files specified in this argument are rendered, otherwise all R
Markdown files specified by the book are rendered.
Arguments to be passed to
rmarkdown::render()
. For preview_chapter()
,
...
is passed to render_book()
.
Whether to clean up the environment envir
before
rendering the book. By default, the environment is cleaned when rendering
the book in a non-interactive R session.
The output directory. If NULL
, a field named
output_dir
in the configuration file _bookdown.yml
will be
used (possibly not specified, either, in which case a directory name
_book
will be used).
Whether to use new R sessions to compile individual Rmd
files (if not provided, the value of the new_session
option in
_bookdown.yml
is used; if this is also not provided,
new_session = FALSE
).
Whether to render and preview the input files specified by the
input
argument. Previewing a certain chapter may save compilation
time as you actively work on this chapter, but the output may not be
accurate (e.g. cross-references to other chapters will not work).
Ignored. The character encoding of all input files is supposed to be UTF-8.
The book configuration file.
There are two ways to render a book from Rmd files. The default way
(new_session = FALSE
) is to merge Rmd files into a single file and
render this file. You can also choose to render each individual Rmd file in a
new R session (new_session = TRUE
).