Talk with the Abuja R User Group
Victor Ordu
22 November, 2022
A suite of functions for:
dev branch)states objects (S3 classes)A special vector constructed with the states() function:
Objects representing the sub-national divisions inherit from an abstract class regions to confer a particular behaviour.
regions is an abstract class i.e. it does not have constructible objects, but exists to define shared behaviour between states and lgas.states has additional arguments:
function (states, gpz = NULL, all = TRUE, warn = TRUE)
NULL
gpz - a geopolitical zone (string)all - include FCT in the result? (logical)warn - notify if an element is not a valid State (logical)lgas objects - saferBecause of this the function signature is more involved:
function (region = NA_character_, strict = FALSE, warn = TRUE)
NULL
Note:
region - i.e. one or more States (character vector only) or selected LGAs.strict - use LGA when there is name-sharing (logical, default is FALSE).warn - notify of wrong spelling (logical).is_* - are elements of the object what they claim to be?fix_* - carry out repairs.Example:
Fixing LGA spellings
fix_region_manual().Deal with poorly entered phone numbers and MS Excel mutilations using fix_mobile.
Numbers that cannot be repaired are turned into missing values i.e. NAs.
[1] "08034510441" NA "09014358956"
Note that one of the digits of nums[3] is not 0 but O. The function automatically repairs it.
function (region = character(), data = NULL, x = NULL, y = NULL,
breaks = NULL, categories = NULL, excluded = NULL, exclude.fill = NULL,
title = NULL, caption = NULL, show.neighbours = FALSE, show.text = FALSE,
legend.text = NULL, leg.x = deprecated(), leg.y = deprecated(),
leg.title, leg.orient = deprecated(), ...)
NULL
What do you expect to be the result of the following code?
Consider the following possibilities:
We can also create choropleth maps using the map_ng() function. For more info, read the vignette
The package is not yet feature complete. Many changes still ahead:
To contact me, visit my GitHub profile: https://github.com/BroVic