lgas: Create on Object for Local Government Areas

View source: R/regions.R

lgasR Documentation

Create on Object for Local Government Areas

Description

Create on Object for Local Government Areas

Usage

lgas(region = NA_character_, strict = FALSE, warn = TRUE)

lgas_ng(state = NA_character_)

Arguments

region

Context-dependent. Either State(s) of the Federation or Local Government Area(s) - internal checks are performed to determine what applies. In cases where States are synonymous to LGAs, the default behaviour is to use the State as a basis for selecting the LGAs. This can be modified with strict. The default value is NA_character_ and will return all 774 LGAs.

strict

logical; in the event of a name clash between State/LGA, return only the specified LGA when this argument is set to TRUE.

warn

logical; issue a warning when one or more elements are not actually Local Government Areas (or were misspelt).

state

Character; State(s) in the Federation of Nigeria. Default is NA_character_.

Value

If length of ng.state == 1L, a character vector containing the names of Local Government Areas; otherwise a named list, whose elements are character vectors of the LGAs in each state.

Note

There are six (6) LGAs that share names with their State - Bauchi, Ebonyi, Gombe, Katsina, Kogi and Ekiti.

lga_ng stands deprecated and will be removed in the next minor version. New code should use lgas instead.

Examples

how_many_lgas <- function(state) {
  require(naijR)
  stopifnot(all(is_state(state)))
  cat(sprintf("No. of LGAs in %s State:", state),
    length(lgas(state)),
    fill = TRUE)
}
how_many_lgas("Sokoto")
how_many_lgas("Ekiti")


naijR documentation built on Aug. 8, 2023, 5:13 p.m.