Skip to contents

Reads the project's .qmd and .Rmd documents and counts each capitalised word that is followed, in the same block, by a typed number ("Site 3", "Stage 2"). Such words are candidates for the label_words setting, which exempts the number after them from the numeral lint. Cross-reference words (Figure, Table, ...), common function words and words already in label_words are left out. Nothing is written.

Usage

label_seed(paths = NULL, min_count = 2)

Arguments

paths

NULL (every document of the project the working folder is in, by the rules of dict_seed()), or document paths.

min_count

The fewest times a word must occur to be listed.

Value

A data frame with word, n (how many times), files (in how many files) and where (up to three places as <file>:<line>: <word> <numeral>), sorted by n and then word.

Examples

dir <- tempfile("weft-example")
dir.create(dir)
writeLines("", file.path(dir, "_weft.yml"))
writeLines(c(
  "---",
  "title: Survey",
  "---",
  "",
  "We visited 14 sites.",
  "",
  "```{r}",
  "n_high <- 3",
  "```",
  "",
  "[No site | One site | # sites]{n=n_high} read high."
), file.path(dir, "survey.Rmd"))
label_seed(file.path(dir, "survey.Rmd"), min_count = 1)
#> [1] word  n     files where
#> <0 rows> (or 0-length row.names)
unlink(dir, recursive = TRUE)