Introduction

This report presents the geocoding of Zenith Bank branches in Lagos State, Nigeria, to enhance spatial analysis and inform business strategies. The geocoding process was carried out using R.

R code

# load readxl and tidyverse packages
library(readxl)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.5.1     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.1
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
# import zenith bank branches data set
zenith_branches <- read_excel("C:/Users/HP/Downloads/zen ith-branches.xlsx")
zenith_branches
## # A tibble: 107 Ă— 4
##    `S/N` LOCATION                             CITY  ADDRESS                     
##    <dbl> <chr>                                <chr> <chr>                       
##  1     1 Lagos University Teaching Hospital   Lagos LUTH, Ishaga Road, Idi-Arab…
##  2     2 Zenith Branch, Abalti Barracks       Lagos 37/39 Western Avenue, Surul…
##  3     3 Zenith Branch, Acme Road             Lagos Plot 12 Block E, Ogba Indus…
##  4     4 Zenith Branch, Adetokunbo Ademola    Lagos Plot 861, Adetokunbo Ademol…
##  5     5 Zenith Branch, Adeniran Ogunsanya    Lagos 58B , Adeniran Ogunsanya St…
##  6     6 Zenith Branch, Adeniyi Jones         Lagos No. 65, Adeniyi Jones Stree…
##  7     7 Zenith Branch, Lekki (ADMIRALTY WAY) Lagos Adiralty Road Lekki Penissu…
##  8     8 Zenith Branch, Agege Motor Road      Lagos 53/55, Old Lagos-Abeokuta R…
##  9     9 Zenith Branch, Agidingbi             Lagos 8/10 Lateef Jakande, Agidin…
## 10    10 Zenith Branch, Aguda                 Lagos 15 Enitan Street, Aguda, Su…
## # ℹ 97 more rows
# view zenith bank branches data set
view(zenith_branches)

# check the structure of zenith_branches data set
str(zenith_branches)
## tibble [107 Ă— 4] (S3: tbl_df/tbl/data.frame)
##  $ S/N     : num [1:107] 1 2 3 4 5 6 7 8 9 10 ...
##  $ LOCATION: chr [1:107] "Lagos University Teaching Hospital" "Zenith Branch, Abalti Barracks" "Zenith Branch, Acme Road" "Zenith Branch, Adetokunbo Ademola" ...
##  $ CITY    : chr [1:107] "Lagos" "Lagos" "Lagos" "Lagos" ...
##  $ ADDRESS : chr [1:107] "LUTH, Ishaga Road, Idi-Araba, Lagos, Nigeria." "37/39 Western Avenue, Surulere, Lagos State." "Plot 12 Block E, Ogba Industrial Estate, Acme Road, Ogba, Ikeja, Lagos State." "Plot 861, Adetokunbo Ademola Street, Victoria Island Lagos" ...
# check the dimension of zenith_branches data set
dim(zenith_branches)
## [1] 107   4
# load tigygeocoder package
library(tidygeocoder)

# geocode address to lat/long
geo_code_tbl <- zenith_branches %>%
  tidygeocoder::geocode(
    address = ADDRESS,
    method ="google"
  )
## Passing 106 addresses to the Google single address geocoder
## Query completed in: 66.9 seconds
# view geo_code_tbl
view(geo_code_tbl)

# load sf package
library(sf)
## Linking to GEOS 3.12.1, GDAL 3.8.4, PROJ 9.3.1; sf_use_s2() is TRUE
# convert geo_code_tbl to sf object with specified coordinates
zenith_branches2 <- geo_code_tbl

zenith_branches_sf <- zenith_branches2 %>%
  st_as_sf(
    coords = c("long", "lat"),
    crs    = 4326
  )
# load leaflet package
library(leaflet)

# create an interactive map of zenith_branches_sf using leaflet package
zenith_branches_sf %>%
  leaflet() %>%
  addProviderTiles (providers$OpenStreetMap, group = "OpenStreetMap") %>%
  addMarkers (label = zenith_branches_sf$LOCATION,
              clusterOptions = markerClusterOptions(),
              popup = ifelse(!is.na(zenith_branches_sf$CITY),
                             zenith_branches_sf$CITY,
                             "Not sure of the branch's location"))

Interpretation

This interactive map shows the different locations of Zenith Bank branches in Lagos State, Nigeria.

# load mapview package
library(mapview)

# create an interactive map of zenith_branches_sf using mapview package
mapview(zenith_branches_sf)

Interpretation

This interactive map shows the different locations of Zenith Bank branches in Lagos State, Nigeria.

Conclusion

By geocoding Zenith Bank branches in Lagos State, Nigeria, this analysis reveals their spatial distribution and can therefore enhance business strategies, branch optimization, and customer accessibility.