states() # lists names of all States
states(gpz = "se") # lists States in South-East zone
all(is_state(naijR::states()))
is_state(c("Maryland", "Baden-Baden", "Plateau", "Sussex"))
# With coercion
kt.st <- states("Katsina") # Ensure this is a State, not an LGA.
kt.lg <- suppressWarnings(as_lga(kt.st))
is_state(kt.st) # TRUE
is_lga(kt.lg) # TRUE
## Where there's no ambiguity, it doesn't make sense to coerce
## This kind of operation ends with an error
if (FALSE) {
as_state("Kano")
as_lga("Michika")
}
Run the code above in your browser using DataLab