Spell Check Utilities
Utilities for spell checking packages via Aspell, Hunspell or Ispell.
aspell_package_Rd_files(dir, drop = c("\\author", "\\references"), control = list(), program = NULL, dictionaries = character()) aspell_package_vignettes(dir, control = list(), program = NULL, dictionaries = character()) aspell_package_R_files(dir, ignore = character(), control = list(), program = NULL, dictionaries = character()) aspell_package_C_files(dir, ignore = character(), control = list(), program = NULL, dictionaries = character())aspell_write_personal_dictionary_file(x, out, language = "en", program = NULL)
- a character string specifying the path to a package's root directory.
- a character vector naming additional Rd sections to drop
when selecting text via
- a list or character vector of control options for the spell checker.
- 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
ispell(in that order), and the first one found is used.
- a character vector of names or file paths of
additional R level dictionaries to use. See
- a character vector with regular expressions to be replaced by blanks when filtering the message strings.
- a character vector, or the result of a call to
- a character string naming the personal dictionary file to write to.
- a character string indicating a language as used by Aspell.
aspell_package_C_files perform spell checking on the Rd files,
vignettes, R files, and C-level messages of the package with root
dir. They determine the respective files, apply the
appropriate filters, and run the spell checker.
aspell for details on filters.
The C-level message string are obtained from the
po/PACKAGE.pot message catalog file, with PACKAGE
the basename of
dir. See the section on C-level
messages in Writing R Extensions for more information.
When using Aspell, the vignette checking skips parameters and/or
options of commands
\samp. Further commands can
be skipped by adding
--add-tex-command options to the
control argument. E.g., to skip both option and parameter of
Suitable values for
ignore can also be
specified using a package defaults file which should go as
defaults.R into the .aspell subdirectory of
and provides defaults via assignments of suitable named lists, e.g.,
vignettes <- list(control = "--add-tex-command='mycmd op'")for vignettes (when using Aspell) and similarly assigning to
C_filesfor Rd files, R files and C level message defaults.
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 control options -d en_US,en_GB to Hunspell (provided that the corresponding dictionaries are installed).
Older versions of R had no support for R level dictionaries, and
hence provided the function
aspell_write_personal_dictionary_file to create (spell check)
program-specific personal dictionary files from words to be accepted.
The new mechanism is to use R level dictionaries, i.e., .rds
files obtained by serializing character vectors of such words using
saveRDS. For such dictionaries specified via the
package defaults mechanism, elements with no path separator can be R
system dictionaries or dictionaries in the .aspell