Missionary clothing are a necessity in Nigeria

My wife and I have this joke we’ve shared since our early days (we’ve been married 22 years).

At any point in time, we want to have what we’ve dubbed ‘missionary’ clothes. What does this mean? Missionary clothes are those that do not require ironing to look acceptable.

The term was coined by Her Royal Majesty and it’s in reference to the cassock worn by priests and monks.

The missionary outfit

In Nigeria, power supply has always been erratic and sometimes could be totally absent for days. Have a meeting to attend today? Tough luck, you might end up putting on a rumpled shirt.

Some people avoid this burden by sending their clothes to ‘washermen’, local laundrymen who will also iron the clothes for you. This is big business in our area.

But it’s always a good idea to have some missionary clothes.

What do you think?

Leave a comment

Filed under Rants

RQDAassist 0.5.0

This is to introduce a new iteration of the RQDAassist package (version 0.5.0). This version comes with the possibility of installing RGtk2 and cairoDevice via their archived binaries, instead of solely installing source tarballs. The advantage is the installation is much quicker and the interactions with the GTK distribution are much more easily handled. The downside of the binary installation is that it can only be done reliably during an interactive R session.

The binary installation option is the default. Thus, to install RQDA, we run

RQDAassist::install()

To install via source, we change the arguments:

RQDAassist::install(type = "source")

When doing the binary installation, if RGtk2 is newly installed and GTK does not exist on the machine, the function stops at some point and the user is invited to install GTK. This is done by first attaching the package

library(RGtk2)

The user is then prompted with a dialog, for the installation of Gtk+.

Dialog for the installation of GTK+
Dialog for GTK+ installation

After GTK+ is installed, one may see an error message in the console–ignore this. Once done, run RQDAassist::install() again, and the remaining packages will be installed.

For more information about this version, please visit the package’s GitHub page. Let me know your thoughts in the comments.

Leave a comment

Filed under data science

naijR 0.3.1

The naijR package has been updated (version 0.3.1) and is now available on CRAN. Here are the most recent user-visible changes:

New stuff

Creation of custom objects representing LGAs

The function lgas is used to construct objects representing the Local Government Areas (LGAs) as described in an earlier post. The function, when supplied the name of a State, automatically creates an object with all the LGAs belonging to that State. On the other hand, when it receives the name(s) of actual LGAs, it can also create similar objects. The problem is that there are some LGAs that are named after their State – namely Bauchi, Ebonyi, Ekiti, Gombe, Katsina, and Kogi. To avoid this mix-up, we can now state uneqoivocally whether we want to work with the LGA or State by setting the strict argument to TRUE or FALSE, respectively. Thus

lgas("Ekiti")
## LGAs
## ---- 
## * Ado Ekiti
## * Efon
## * Ekiti East
## * Ekiti South-West
## * Ekiti West
## * Emure
## * Gbonyin
## * Ido Osi
## * Ijero
## * Ikere
## * Ikole
## * Ilejemeje
## * Irepodun/Ifelodun
## * Ise/Orun
## * Moba
## * Oye 
# Return only specified LGA
(x <- lgas("Ekiti", strict = TRUE))
## States
## ------ 
## * Ekiti 
# Confirm the object
class(x)
## [1] "lgas"      "regions"   "character"

Bug fix for State-level LGA maps

There was a subtle bug that was introduced in an earlier update that really ruined some of the LGA maps for some States. For example, the Borno State LGA maps turned out like this:

map_ng(lgas("Borno"))

One may see something drawn in the southwesterly direction–this is actually an LGA from a different State with a name similar to one in Borno. Some other States’ maps were much worse because of this bug. This was fixed by the introduction of stricter subsetting rules. Under the current version of naijR, the map of Borno’s LGAs now looks like this:

Installation

The new version of naijR can be installed in an active R session from CRAN with:

install.packages("naijR")

To try out development versions as they come, you can get it from GitHub, after loading either the devtools or remotes package, with:

install_github("BroVic/naijR")

Happy coding!

Leave a comment

Filed under data science

naijR 0.3.0

This is to announce the arrival of naijR v.0.3.0 on CRAN.

Changes

This version of the package introduces new functionality as well as a number of bug fixes.

Construction of objects modelling administrative regions

The functions states and lgas are used to create objects that represent States or Local Government Areas (LGAs), respectively. Hitherto, these functions produce a warning whenever an element (a string) used in constructing these objects is not a correctly spelt region. Because these functions are originally intended for low-level use, coupled with the high propensity for spelling mistakes (particularly with LGAs), the warning was often more of a nuisance. So, the decision was made to provide a logical argument warn to introduce a way to turn on/off the warnings.

Cleaner output

Most of the console output from functions in the package were improved upon to make them more reader-friendly. Similarly, conditions e.g. messages, warnings, were made to convey more relevant information for an enhanced user experience.

Bug fixes

  • In the former version, the default method for fix_region, when called with a vector that contains misspelt LGAs, was exhibiting some not-so-useful behaviour. This has been substantially improved.
  • When the function lgas was called without attaching the package i.e. with the :: operator, it failed because the internally accessed data were not loaded simultaneously. This was been fixed by enabling internal loading of the data in the function environment.

Usage

To use the package in R, it can be installed from CRAN and then activated as follows:

install.packages("naijR")
library(naijR)

To access the development version of the package and try out the latest features, use

if (!requireNamespace("remotes"))
  install.packages("remotes")
remotes::install_github("BroVic/naijR")

To visit the package website, click here.

Leave a comment

Filed under data science

Mapping Nigeria’s Geopolitical Zones in R

The other day I got an email from a researcher who is using the naijR package, which, among other things, helps with the drawing of plot maps of Nigeria. He was having trouble drawing maps of the geopolitical zones (GPZ) of the country.

Admittedly, this is an omission from the package, but a deliberate one. I had actually toyed with the idea of baking this feature in, but since the GPZ is not “officially” recognized, I opted for the package to be relatively silent, as only States and Local Government Areas are recognized in the Nigerian Constitution.

Anyway, after a few emails back and forth, I was able to help him resolve the issue. Basically, since the states() function can extract the States by GPZ (via the gpz argument), we can use this little dearie to extract the States of a GPZ and pass it to the region argument of map_ng(). For the Northeast GPZ, this gives us a map that might look like this:

Delineating all the GPZ on a country map is a little trickier and we have to do some functional programming. One approach is to generate a data frame with the contiguous States matched to a factor that represents each GPZ. Then, we draw a choropleth map by passing that data frame to the data argument of map_ng(), while the factor is passed to the x argument. Information for using these arguments can be found in ?map_ng(). In the output below, I chose reddish colouring for the map.

Problem solved. The code for this solution can be found in this GitHub Gist. To get the raw script, follow this link. I think I’m going to have to review the decision on not implementing a native drawing of GPZ maps in naijR.

Leave a comment

Filed under Computers & Internet, data science