Tag Archives: Nigeria

naijR 0.2.2

This post is to announce the arrival of naijR 0.2.2 on CRAN.

New S3 classes

This version of the package introduces the use of an object-oriented style to programming, making available constructors for states and lgas objects. To create instances of both classes, we pass a character vector of States or LGAs as appropriate. These constructors are somewhat permissive and do not perform strict accuracy checks. For that we have the functions is_state and is_lga.

Check for LGAs

There are 774 LGAs in the country and they are pivotal to any analytic tasks done with country data. They are also very often misspelt as any dataset taken from the wild would reveal. I have taken the pains to provide authoritative appellation for this tier of governance using government sources. This can be easily inspected in the inbuilt package dataset lgas_nigeria.

The new function is_lga will scan through a vector to check whether its elements have correctly spelt LGAs. Where poorly spelt ones are found, the function fix_region can be used to correct this. The method for lgas objects will attempt to do this automatically using partial matching. For example

> library(naijR)

> mylga <- c("Amuwo-Odofin", "Bukuru", "Askira-Uba")

> is_lga(mylga)

Fix mispelt regions

A major addition in the current version is the function fix_region, which helps a user to repair any misspelt adminstrative regions within a dataset. The function has methods for different kinds of regions i.e. States and Local Government Areas, which are optionally represented as the S3 objects states and lgas, respectively. However, the function also has a method for base character vectors, mainly for States, since they are not that many. To repair our vector my_lga, we will create an lgas object first and then pass it as an argument to fix_region.

> fixed <- fix_region(lgas(mylga))
Approximate match(es) not found for the following:
* Bukuru
Warning message:
In lgas(mylga) : One or more elements is not an LGA

> fixed
[1] "Amuwo-Odofin" "Bukuru"       "Askira/Uba"

The LGA Askira-Uba has been corrected to its correct spelling, Askira/Uba. However, a match could not be found for the element Bukuru. (Bukuru is actually the name of the headquarters of Jos South LGA of Plateau State). To continue attempting to repair our vector, we run fix_region in interactive mode

> fixed <- fix_region(lgas(mylga), interactive = TRUE)
Approximate match(es) not found for the following:
* Bukuru
Do you want to repair interactively? (Y/N): 

The user is prompted to continue interatively. To continue enter something like y.

Fixing ‘Bukuru’
Search pattern: buk
Select the LGA 

1: Bukkuyum
2: Retry
3: Skip
4: Quit

We are searching for options using the search term buk and only one option was returned i.e. Bukkuyum. Unfortunately, that’s not the one we are looking for so we will enter 2 and run the search again, by passing only bu

Selection: 2
Search pattern: bu
Select the LGA 

 1: Buruku                         2: Akpabuyo                    
 3: Obubra                         4: Obudu                       
 5: Burutu                         6: Abuja Municipal Area Council
 7: Babura                         8: Buji                        
 9: Bunkure                       10: Sabuwa                      
11: Bunza                         12: Kabba/Bunu                  
13: Ijebu East                    14: Ijebu North                 
15: Ijebu North East              16: Ijebu Ode                   
17: Abua/Odual                    18: Tambuwal                    
19: Bursari                       20: Bukkuyum                    
21: Bungudu                       22: Retry                       
23: Skip                          24: Quit      

The LGA I wanted to select was Buruku, so I pick option 1

Selection: 1
Warning message:
In lgas(mylga) : One or more elements is not an LGA

> fixed
[1] "Amuwo-Odofin" "Buruku"       "Askira/Uba"  
> is_lga(fixed)

We’ve fixed the LGAs! At this point, any LGAs that could not be fixed can be treated be directly manipulation of the object,


This version of the package provides increased granularity for the Nigeria country map, currently going down to LGA levels.


To know more about drawing Nigeria maps with the package, see the documentation (?map_ng) or read the vignette.


This version of naijR brings some new functionality to aid with data cleaning and validation of LGA names, as well as LGA level mapping. I would like you to try it out and give me some feedback.

Leave a comment

Filed under Data Scoemce

Roast corn in Abuja, Nigeria

Motorists drop by regularly to enjoy this tasty corn... Are you drooling yet?

Motorists drop by regularly to enjoy this tasty corn… Are y’all drooling yet?


January 18, 2016 · 12:25 PM

Be selective which debit card you use in Nigeria

Atm clip art

Sometimes one wonders whether the people in the government ever know what they are doing.

The other day, I tried using an ATM belonging to Fidelity Bank, but the machine decided to retain the card. This was after a successful transaction a few minutes earlier on the same machine. I was asked by the security guard to come the following day as it was already very late.

On getting to the bank the following morning, rather than return my card or direct me on where I could collect it (the last time such a thing happened at the same branch, I was referred to my bank (Zenith Bank) for collection – and it went smoothly.

To my utter dismay, I was informed that in line with current central bank regulations, all ATM cards that got stuck in machines other than those belonging to the issuing bank were to be forfeited and destroyed. This really got me angry as I questioned the rationale behind this, given that whenever we used our debit cards on ATMs of other banks, we were being charged N65 per transaction (or thereabouts).

Well, I had no choice but to go to my bank for a new debit card. I got my replacement quite alright, but (1) I had to wait 5 working days to collect it, (2) it set me back N1,000 and (3) the validity period of my “new” card is just 5 months, which means that, technically, I’m still operating my old card.

So, is it any wonder that the government’s ‘Cashless Policy’ is a total failure? I wonder what part of the body they use to do their thinking…

If you’re in Nigeria, my advice to you is this: Never use your debit card on an ATM that does not belong to issuing bank. The stress you will face should anything go wrong (not to talk of the expense) is not worth the so-called ‘convenience’.

Debit xard

Leave a comment

Filed under Rants

It’s happening live in Lagos!










I might as well brag on my country.

I am presently in Lagos, Nigeria where I will be attending Social Media Week, Lagos. This happens to be the premier event that has to do with social media in Nigeria – experts from different sectors, enthusiasts, lobbyists, activists, government officials, businessmen and tech-preneurs – will be rubbing minds over the next five or so days. Check out the schedule!

I’m just here to learn, so I have nothing to prove and nothing to show. There will be a number of online events, so if you care you can come and take a look, especially if you’re not residing in Nigeria. My country is really “the place to be” and promises to be the next “great frontier” as far as business is concerned.

The beautiful Toks Bakare

I specially want to announce an event  that will be hosted within the week by Toks Bakare, an internationally-acclaimed behavioural analyst who works with children that have special educational needs (particularly those with autism spectrum disorder). This powerful event will be held both online and offline, so anyone can participate.

Nigeria, Good People, Great Nation!

Leave a comment

Filed under Computers & Internet