Skip to contents

A simpler, but considerably faster alternative to devtools::build_readme() since it doesn't install your package in a temporary library before building the README.Rmd. This has the pleasant side effect that, other than the latter function, it also works for .Rmd files which aren't part of an R package.

Usage

build_readme(
  input = "README.Rmd",
  output = "README.md",
  build_index_md = NULL,
  env = parent.frame(),
  clean = TRUE,
  quiet = FALSE
)

Arguments

input

Path to the R Markdown README file to be built. A character scalar.

output

Path to the built Markdown README. A character scalar.

build_index_md

Whether to build a separate pkgdown-optimized pkgdown/index.md alongside output (i.e. in the same parent directory). If NULL, it will only be built if the parent directory of output contains a pkgdown configuration file. Note that it will be built with the R option pal.build_readme.is_pkgdown set to TRUE, allowing for conditional content inclusion in input – e.g. via the code chunk option eval = isTRUE(getOption("pal.build_readme.is_pkgdown")).

env

Environment in which code chunks are to be evaluated, e.g. base::parent.frame(), base::new.env(), or base::globalenv().

clean

Whether or not to delete intermediate files created by rmarkdown::render().

quiet

Whether or not to suppress printing status output from internal processing.

Value

The path to input as a character scalar, invisibly.

Details

Note that for public package repositories, it's recommended to use devtools::build_readme() since it ensures the README.Rmd can be built reproducibly, which means all the objects and files it references must be accessible from the repository.

This function is also registered as an RStudio add-in, allowing RStudio users to assign a custom shortcut to it or to invoke it from the command palette.

See also

Other R Markdown and knitr functions: knitr_table_format(), strip_yaml_header()