title: “Demography Charts, South South Nigeria(NPC 2006 census) Copyright@mapsnigeriainitiative” output: flexdashboard::flex_dashboard: orientation: columns vertical_layout: fill —

Column

Geographical Boundaries of the States in Southern Nigeria, West Africa

library(leaflet)
## Warning: package 'leaflet' was built under R version 3.3.3
library(raster)
## Loading required package: sp
bas <- shapefile("C:/Regions shapefiles/southsouth.shp")

pal <- colorFactor(c("brown", "yellow", "blue", "green", "cyan", "red"), domain = c("Akwa Ibom", "Bayelsa", "Cross River", "Delta", "Edo", "Rivers"))

leaflet(width='80%')%>%
  addTiles()%>%
  setView(lng=7.00, lat=4.00, zoom=7)%>%
  addPolygons(data = bas,weight = 1, fill = TRUE, stroke = TRUE, color = ~pal(NAME_1),  popup = paste0(paste0("<strong style='color:red'>Name: </strong>", 
                      bas$NAME_1, 
                      "<br><strong>Capital: </strong>", 
                      bas$capital)
  ), group = "bas")%>%
addLegend("bottomright", colors = c("brown", "yellow", "blue", "green", "cyan", "red"), labels = c("Akwa Ibom", "Bayelsa", "Cross River", "Delta", "Edo", "Rivers"))

Column

Population Chart

Stacked bar chart showing male and female populations in the states

library(plotly)
## Loading required package: ggplot2
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:raster':
## 
##     select
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
library(ggplot2)
States <- c("Akwa Ibom", "Bayelsa", "Cross River", "Delta", "Edo", "Rivers")
Male <- c(2044510,902648,1492465,2074306,1640461,2710665)
Female <- c(1875698,800710,1396501,2024085,1577871,2474735)
data <- data.frame(States, Male, Female)

p <- plot_ly(data, x = ~States, y = ~Male, type = 'bar', name = 'Male') %>%
  add_trace(y = ~Female, name = 'Female') %>%
  layout(yaxis = list(title = 'Population'), barmode = 'stack')
p