R: Spell Check Utilities

aspell-utils {utils} | R Documentation

## Spell Check Utilities

### Description

Utilities for spell checking packages via Aspell, Hunspell or Ispell.

### Usage

    aspell_package_Rd_files(dir, drop = c("\\author", "\\references"),
                            control = list(), program = NULL)
    aspell_package_vignettes(dir, control = list(), program = NULL)
    aspell_write_personal_dictionary_file(x, out, language = "en",
                                          program = NULL)

### Arguments

`dir` | a character string specifying the path to a package's root directory.
`drop` | a character vector naming additional Rd sections to drop when selecting text via `RdTextFilter`.
`control` | a list or character vector of control options for the spell checker.
`program` | a character string giving the name (if on the system path) or full path of the spell check program to be used, or `NULL` (default). By default, the system path is searched for `aspell`, `hunspell` and `ispell` (in that order), and the first one found is used.
`x` | a character vector, or the result of a call to `aspell()`.
`out` | a character string naming the personal dictionary file to write to.
`language` | a character string indicating a language as used by Aspell.

### Details

`aspell_package_Rd_files` and `aspell_package_vignettes` perform spell checking on the Rd files and vignettes of the package with root directory `dir`. They determine the respective files, apply the appropriate filters, and run the spell checker.

When using Aspell, the vignette checking skips parameters and/or options of commands

    \Sexpr

,

    \citep

,

    \code

,

    \pkg

,

    \proglang

and

    \samp

. Further commands can be added by adding

    --add-tex-command

options to the `control` argument. E.g., to skip both option and parameter of

    \mycmd

, add

    --add-tex-command='mycmd op'

. Suitable values for `control`, `program` and `drop` and personal dictionaries can also be specified using a package defaults file which should go as ‘defaults.R’ into the ‘.aspell’ subdirectory of `dir`, and provides defaults via assignments of suitable named lists, as e.g.

      vignettes <- list(control = "--add-tex-command='mycmd op'")

for vignettes (when using Aspell) and assigning to `Rd_files` for Rd files defaults, and using elements `program`, `drop` and `personal` for the respective default values. Maintainers of packages using both English and American spelling will find it convenient to pass control options --master=en_US and --add-extra-dicts=en_GB to Aspell and -d en_US,en_GB to Hunspell (provided that the corresponding dictionaries are installed). One can also use personal dictionaries containing additional words to be accepted as spelled correctly. Via `aspell_write_personal_dictionary_file`, a personal dictionary file can be created by either giving the words directly as a character vector, or as an object from a call to `aspell()` (in which case all possibly misspelled words contained in the object are taken). Most conveniently, the file is then moved to the package source ‘.aspell’ subdirectory (named, e.g., ‘vignettes.pws’) and then activated via the defaults file using, e.g.,

      vignettes <- list(control = "--add-tex-command='mycmd op'",
                        personal = "vignettes.pws")

### See Also

`aspell`

[Package utils version 2.15.2 Index]