Skip to contents

Downloads a dictionary from the GitLab repository. The dictionary is saved to the package's on-demand data folder for future use.

Usage

download_dictionary(
  name,
  format = c("qs2", "rda"),
  path = NULL,
  overwrite = FALSE,
  quiet = FALSE,
  retries = 3,
  timeout = getOption("timeout")
)

Arguments

name

Character. Dictionary name (e.g., "global_surnames").

format

Character. File format: "qs2" (default, smaller and faster) or "rda".

path

Character. Custom save location. If NULL, saves to the package's ondemand folder. Can be an absolute or relative path.

overwrite

Logical. Overwrite existing file if it exists? Default FALSE.

quiet

Logical. Suppress download messages? Default FALSE.

retries

Integer. Number of download retries on failure. Default 3.

timeout

Integer. Download timeout in seconds. Defaults to getOption("timeout") (typically 60). Increase for large dictionaries on slow connections.

Value

The file path where the dictionary was saved (invisible). For core dictionaries, returns the path to the existing installed file. For on-demand dictionaries that already exist, returns the existing path unless overwrite = TRUE.

Details

After downloading, the file's MD5 checksum is verified against the bundled checksums to ensure integrity. If the checksum does not match, a warning is issued.

See also

load_dictionary for the main loading function, list_dictionaries for available dictionaries, verify_dictionary to check integrity of a local dictionary.

Examples

if (FALSE) { # \dontrun{
# Download a dictionary (will prompt if file exists)
download_dictionary("global_surnames")

# Download with RDA format
download_dictionary("english_freqs", format = "rda")

# Download to custom location
download_dictionary("organisms", path = "/my/data")
} # }