Learn R Programming

naijR (version 0.3.2)

lgas: List Local Government Areas

Description

List Local Government Areas

Usage

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

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.

warn

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

strict

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

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.

Examples

Run this code
# NOT RUN {
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")

# }

Run the code above in your browser using DataLab