Package 'rgisDR'

Title: GIS tools for Dominican Republic boundaries in R
Description: The rgisDR package provides simple features for the administrative divisions of the Dominican Republic, facilitating comprehensive geospatial analysis and mapping. It also includes tools for cleaning and standardizing administrative names, ensuring accurate and consistent naming conventions across provinces, municipalities, and municipal districts, among others.
Authors: Daniel E. de la Rosa [aut, cre], Adatar [cph]
Maintainer: Daniel E. de la Rosa <[email protected]>
License: MIT + file LICENSE
Version: 0.3.0
Built: 2024-11-15 06:22:56 UTC
Source: https://github.com/adatar-do/rgisDR

Help Index


Clean Dominican Republic municipal district names [Experimental]

Description

This function cleans and standardizes the names of municipal districts (distritos municipales) in the Dominican Republic. It can also handle related names for municipalities and provinces, with tolerance for string similarity and options for error handling.

Usage

dr_clean_md_name(
  md,
  .mun = NULL,
  .prov = NULL,
  .tol = 0.33,
  .on_error = "fail"
)

Arguments

md

Character vector of municipal district names to be cleaned.

.mun

Optional character vector of municipality names. Defaults to NULL. If provided, it will clean and match the municipal district names within the context of these municipalities.

.prov

Optional character vector of province names. Defaults to NULL. If provided, it will clean and match the municipal district names within the context of these provinces.

.tol

Numeric tolerance level for string similarity. Defaults to 0.33. This parameter controls how similar two strings must be to be considered a match. A lower value means stricter matching.

.on_error

Character string specifying the error handling method. Defaults to "fail". It can be one of the following: "fail" to stop execution on error, "omit" to ignore unmatched names, or "na" to return NA for unmatched names.

Value

A cleaned character vector of municipal district names.

Examples

## Not run: 
# Basic usage with municipal district names only
cleaned_md_names <- dr_clean_md_name(c("Distrito Nacion...", "Azua"))

# Usage with municipality names
cleaned_md_names <- dr_clean_md_name(
  c("DISTRITO NACIONAL", "Azua"),
  .mun = c("DISTRITO NACIONAL", "Azua de Compostela")
)

## End(Not run)

Clean Dominican Republic municipality names [Experimental]

Description

This function cleans and standardizes the names of municipalities in the Dominican Republic. It can also handle related names for provinces, with tolerance for string similarity and options for error handling.

Usage

dr_clean_mun_name(mun, .prov = NULL, .tol = 0.33, .on_error = "fail")

Arguments

mun

Character vector of municipality names to be cleaned.

.prov

Optional character vector of province names. Defaults to NULL. If provided, it will clean and match the municipality names within the context of these provinces.

.tol

Numeric tolerance level for string similarity. Defaults to 0.33. This parameter controls how similar two strings must be to be considered a match. A lower value means stricter matching.

.on_error

Character string specifying the error handling method. Defaults to "fail". It can be one of the following: "fail" to stop execution on error, "omit" to ignore unmatched names, or "na" to return NA for unmatched names.

Value

A cleaned character vector of municipality names.

Examples

## Not run: 
  # Basic usage with municipality names only
  cleaned_mun_names <- dr_clean_mun_name(c("Santo dominio este", "Azua de Compostela"))

  # Usage with province names
  cleaned_mun_names <- dr_clean_mun_name(
    c("SANTO DOMINGO DE GUZMAN", "Azua de Compostela"),
    .prov = c("Distrito Nacional", "Azua")
  )

## End(Not run)

Clean Dominican Republic province names [Experimental]

Description

This function cleans and standardizes the names of provinces in the Dominican Republic, with tolerance for string similarity and options for error handling.

Usage

dr_clean_prov_name(prov, .tol = 0.25, .on_error = "fail")

dr_prov_clean_name(names)

Arguments

prov

Character vector of province names to be cleaned.

.tol

Numeric tolerance level for string similarity. Defaults to 0.25. This parameter controls how similar two strings must be to be considered a match. A lower value means stricter matching.

.on_error

Character string specifying the error handling method. Defaults to "fail". It can be one of the following: "fail" to stop execution on error, "omit" to ignore unmatched names, or "na" to return NA for unmatched names.

names

Deprecated. Use prov instead.

Value

A cleaned character vector of province names.

Examples

## Not run: 
  # Basic usage with province names
  cleaned_prov_names <- dr_clean_prov_name(c("montePlata", "Azua"))

## End(Not run)

Clean Dominican Republic section names [Experimental]

Description

This function cleans and standardizes the names of sections in the Dominican Republic. It can also handle related names for municipal districts, municipalities, and provinces, with tolerance for string similarity and options for error handling.

Usage

dr_clean_sec_name(
  sec,
  .dm = NULL,
  .mun = NULL,
  .prov = NULL,
  .tol = 0.33,
  .on_error = "fail"
)

Arguments

sec

Character vector of section names to be cleaned.

.dm

Optional character vector of municipal district names. Defaults to NULL. If provided, it will clean and match the section names within the context of these municipal districts.

.mun

Optional character vector of municipality names. Defaults to NULL. If provided, it will clean and match the section names within the context of these municipalities.

.prov

Optional character vector of province names. Defaults to NULL. If provided, it will clean and match the section names within the context of these provinces.

.tol

Numeric tolerance level for string similarity. Defaults to 0.33. This parameter controls how similar two strings must be to be considered a match. A lower value means stricter matching.

.on_error

Character string specifying the error handling method. Defaults to "fail". It can be one of the following: "fail" to stop execution on error, "omit" to ignore unmatched names, or "na" to return NA for unmatched names.

Value

A cleaned character vector of section names.

Examples

## Not run: 
  # Basic usage with section names only
  cleaned_sec_names <- dr_clean_sec_name(
    c(
      "Santo Domingo de Guzmán (Zona urbana)",
      "Azua de Compost. (Zona urbana)"
     )
  )

  # Usage with municipal district names
  cleaned_sec_names <- dr_clean_sec_name(
    c(
      "SANTO DOMINGO DE GUZMAN (Zona urbana)",
      "Azua de Compostela (Zona urbana)"
    ),
    .dm = c("Distrito Nacional", "Azua")
  )

## End(Not run)