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
alongsideoutput
(i.e. in the same parent directory). IfNULL
, it will only be built if the parent directory ofoutput
contains a pkgdown configuration file. Note that it will be built with the R optionpal.build_readme.is_pkgdown
set toTRUE
, allowing for conditional content inclusion ininput
– e.g. via the code chunk optioneval = 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()
, orbase::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.
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 and to invoke it from the command palette.
See also
Other R Markdown and knitr functions:
knitr_table_format()
,
strip_yaml_header()