Skip to contents

Every render runs these first – all but check_renv(): a render writes renv.lock instead – and stops on what would otherwise reach the document broken. Call them yourself to know before waiting for a render: called on their own, they also say in one line when all is well; inside a render, only what is not.

Usage

check_citations(path = NULL)

check_crossrefs(quiet = FALSE, path = NULL)

check_packages(path = NULL)

check_title(quiet = FALSE, path = NULL)

check_data(quiet = FALSE, path = NULL)

check_renv(quiet = FALSE, path = NULL)

Arguments

path

The project, or any folder inside it. Left out, the one set_paper() named, or else the project the working directory is in: they only read.

quiet

TRUE keeps the notes to yourself and only stops or warns on what is wrong.

Value

check_citations(), check_crossrefs() and check_packages() return TRUE invisibly and stop with an error naming what is missing. check_title() and check_data() return TRUE or FALSE invisibly, with a warning when FALSE. check_renv() returns TRUE in sync, FALSE not, with a warning naming what differs, and NA when it cannot tell.

Details

  • check_citations(): every @key cited in the text has an entry in references/*.bib. Package citations (@R-pkg) are written by the render itself, so a new one is only announced.

  • check_crossrefs(): every @fig-, @tbl-, @sfig-... cited has a figure or table with that label, and says which ones exist but are never cited – journals ask for every figure to be cited in the text. A citation written inside a string of R code counts as cited.

  • check_packages(): every package the manuscript, its sections and R/setup.R load with library() or require() is installed. A missing one otherwise surfaces a minute into the render, from inside Quarto.

  • check_title(): the manuscript has a title of its own, not the template's. It is written once, in the YAML of manuscript.qmd.

  • check_data(): every file the analysis names is in data/, and which files there nothing reads – they would travel to the data repository all the same. It reports; it never removes.

  • check_renv(): renv.lock is there and matches the library in use, package by package: renv's own project library when the project has one (renv::init()), and otherwise the library R is using, which is the one easypaper records.

An e-mail address is not a citation, however it is written: an @ glued to a letter or a digit – any letter, accented ones too – is an address, and \@ is a literal @, which is what RStudio's visual editor writes. That is pandoc's own rule, and pandoc decides what gets cited.

See also

check_species() for the scientific names of the references, and render_docx(), which runs every one of these first.

Examples

dir <- file.path(tempdir(), "my_paper")
create_paper(dir, title = "Ant colonies", git = FALSE)
#> Project created: /tmp/Rtmp92gqjt/my_paper
#>   1. open my_paper.Rproj
#>   2. library(easypaper)
#>   3. set_paper(".")      # the project to work on, once a session
#>   4. render_html()      # see ?render for every command
check_citations(dir)
#> Citations: all 3 found in references/*.bib.
check_crossrefs(path = dir)
#> Cross-references: none in the text yet.
#> Note: defined but never cited in the text: fig-richness, fig-abundance, tbl-models, tbl-summary, sfig-map, stbl-raw
check_title(path = dir)
#> Title: Ant colonies
check_data(path = dir)
#> Data: data/ is empty.
unlink(dir, recursive = TRUE)