aspell {utils} | R Documentation

## Spell Check Interface

### Description

Spell check given files via Aspell, Hunspell or Ispell.

### Usage

    aspell(files, filter, control = list(), encoding = "unknown",
           program = NULL)

### Arguments

`files` | a character vector with the names of files to be checked.
`filter` | an optional filter for processing the files before spell checking, given as either a function (with formals `ifile` and `encoding`), or a character string specifying a built-in filter, or a list with the name of a built-in filter and additional arguments to be passed to it. See Details for available filters. If missing or `NULL`, no filtering is performed.
`control` | a list or character vector of control options for the spell checker.
`encoding` | the encoding of the files. Recycled as needed.
`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.

### Details

The spell check programs employed must support the so-called Ispell pipe interface activated via command line option -a. In addition to the programs, suitable dictionaries need to be available. See http://aspell.net, http://hunspell.sourceforge.net/ and http://lasr.cs.ucla.edu/geoff/ispell.html, respectively, for obtaining the Aspell, Hunspell and (International) Ispell programs and dictionaries.

Currently the only available built-in filters are `"Rd"`, corresponding to `RdTextFilter`, and `"Sweave"`, corresponding to `SweaveTeXFilter`.

The print method has for the objects returned by `aspell` has an `indent` argument controlling the indentation of the positions of possibly mis-spelled words. The default is 2; Emacs users may find it useful to use an indentation of 0 and visit output in grep-mode. It also has a `verbose` argument: when this is true, suggestions for replacements are shown as well.

### Value

A data frame inheriting from `aspell` (which has a useful print method) with the information about possibly mis-spelled words.

### See Also

aspell-utils for utilities for spell checking packages.

Package Aspell on Omegahat (http://www.omegahat.org/Aspell) for a fine-grained R interface to the Aspell library.

### Examples

    ## Not run:
    ## To check all Rd files in a directory, (additonally) skipping the
    ## \references sections.
    files <- Sys.glob("*.Rd")
    aspell(files, filter = list("Rd", drop = "\references"))

    # To check all Sweave files
    files <- Sys.glob(c("*.Rnw", "*.Snw", "*.rnw", "*.snw"))
    aspell(files, filter = "Sweave", control = "-t")

    # To check all Texinfo files (Aspell only)
    files <- Sys.glob("*.texi")
    aspell(files, control = "--mode=texinfo")

    ## End(Not run)

[Package utils version 2.15.2 Index]