Validates your package sources and builds the pkgdown site in a temporary
copy, leaving your man/ files, NAMESPACE, README.md, and docs/
folder untouched. Handy in CI, scripts, and AI agent edit-verify loops.
Arguments
- pkg
Path to an R package (or any file or folder inside it). Defaults to the current directory (
".").- document
Whether to run roxygen2 in the temporary copy before building. Set to
FALSEif you manageman/files yourself. R syntax is still checked, andREADME.Rmdis still rendered if present.- quiet
Whether to hide detailed pkgdown output. Always treated as
TRUEwhenformat = "json"so standard output stays valid JSON.- format
Output format:
"text"(default): print a readable summary and structured diagnostics."json": print one JSON object (ok,package_root,duration,warnings,error, andbuild_log) to standard output.
- error
Whether to signal an error if the build fails. Defaults to
TRUEsoRscript -e "updoc::check()"exits with a non-zero status on failure. Set toFALSEto inspect the returnedupdoc_checkobject without throwing.- pandoc
Path to the directory containing the
pandocbinary (version 2.10.1 or newer). WhenNULL(the default), updoc uses the Pandoc found by rmarkdown. Setoptions(updoc.pandoc = "/path/to/bin")to reuse a specific directory across builds. updoc never downloads Pandoc or changes your system installation.
Value
Invisibly, an updoc_check object with ok, package_root,
duration, warnings, error, and build_log. When error = TRUE and
the check fails, the thrown error message includes the log path and the
condition carries $build_log and $check.
Details
Like serve() and preview(), check() checks R syntax and article YAML
front matter, runs roxygen2 (unless document = FALSE), renders
README.Rmd if present, and builds the site in isolation. Temporary site
files are deleted before returning, while the full build log stays in the
current R session's temporary directory.
Examples
if (interactive()) {
# Verify the site without touching generated files in your package.
check()
# Emit machine-readable JSON for scripts or AI agents.
check(format = "json", error = FALSE)
}