###Data The data this week comes from rKenyaCensus courtesy of Shelmith Kariuki. Shelmith wrote about these datasets on her blog.

Viewing the other datasets under rKenyaCensus

library(tidyverse)
## -- Attaching packages --------------------------- tidyverse 1.3.0 --
## v tibble  3.0.3     v dplyr   1.0.2
## v tidyr   1.1.2     v stringr 1.4.0
## v readr   1.3.1     v forcats 0.5.0
## v purrr   0.3.4
## -- Conflicts ------------------------------ tidyverse_conflicts() --
## x readr::col_factor()    masks scales::col_factor()
## x dplyr::combine()       masks randomForest::combine()
## x purrr::discard()       masks scales::discard()
## x dplyr::filter()        masks stats::filter()
## x dplyr::lag()           masks stats::lag()
## x purrr::lift()          masks caret::lift()
## x randomForest::margin() masks ggplot2::margin()
# create a markdown table for the readme
rKenyaCensus::DataCatalogue %>% 
  knitr::kable()
Dataset Volume Table.No.in.PDFs Dataset.Description
DataCatalogue Shows the table number for each of the datasets
CountyGPS Shows the County GPS centroids
KenyaCounties_SHP Shapefiles of Kenya County boundaries
V1_T2.1 V1 Table 2. 1 Census Indicators at a Glance, 2019
V1_T2.2 V1 Table 2. 2 Distribution of Population by Sex and County
V1_T2.3 V1 Table 2. 3 Distribution of Population, Number of Households and Average
V1_T2.4 V1 Table 2. 4 Distribution of Population, Land Area and Population Density by County
V1_T2.5 V1 Table 2. 5 Distribution of Population by Sex and Sub-County
V1_T2.6 V1 Table 2. 6 Distribution of Population, Number of Households and Average Household Size by Sub- County
V1_T2.7 V1 Table 2. 7 Distribution of Population by Land Area and Population Density by Sub-County
V2_T1.1 V2 Table 1.1 Summary of Census Counts in Kenya
V2_T1.2 V2 Table 1.2 List of Counties and Sub-Counties
V2_T2.1 V2 Table 2.1 Sub-locations with no People on the Census Night by Status/Reason
V2_T2.2 V2 Table 2.2 Distribution of Population by Sex, Number of Households, Land Area, Population Density and County
V2_T2.2a V2 Table 2.2a Distribution of Rural Population by Sex, Number of Households, Land Area, Population Density and County
V2_T2.2b V2 Table 2.2b Distribution of Urban Population by Sex, Number of Households, Land Area, Population Density and County
V2_T2.3 V2 Table 2.3 Distribution of Population by Sex, Number of Households, Land Area, Population Density and Sub County
V2_T2.5 V2 Table 2.5 Distribution of Population by Urban Centres, Sex and County
V3_T1.1 V3 Table 1.1 Summary of Census Counts in Kenya
V3_T1.2 V3 Table 1.2 List of Counties and Sub-Counties
V3_T2.1 V3 Table 2.1 Sub-locations with no People on the Census Night by Status/Reason
V3_T2.2 V3 Table 2.2 Distribution of Population by Age and Sex, Kenya
V3_T2.2a V3 Table 2.2a Distribution of Rural Population by Age and Sex, Kenya
V3_T2.2b V3 Table 2.2b Distribution of Urban Population by Age and Sex, Kenya
V3_T2.3 V3 Table 2.3 Distribution of Population by Age, Sex, County and Sub- County
V3_T2.4a V3 Table 2.4a Distribution of Rural Population by Age, Sex and County
V3_T2.4b V3 Table 2.4b Distribution of Urban Population by Age, Sex and County
V4_T1.1 V4 Table 1. 1 Summary of Census Counts in Kenya.
V4_T1.9 V4 Table 1.9 List of Counties and Sub-Counties
V4_T2.2 V4 Table2.2 Distribution of Population Aged 3 Years and Above by School Attendance Status, Area of Residence, Sex, County and SubCounty.
V4_T2.3 V4 Table 2.3 Distribution of Population Aged 3 Years and Above Currently Attending School/ Learning Institution by Education Level, Area of Residence, Sex, County and Sub-County
V4_T2.4 V4 Table 2.4 Distribution of Population Aged 3 Years and Above by Highest Level of Education Reached, Area of Residence, Sex, County and Sub-County..
V4_T2.5 V4 Table 2.5 Distribution of Population Aged 3 Years and Above by Highest Level of Education Completed, Area of Residence, Sex, County and Sub-County..
V4_T2.6a V4 Table 2.6a Distribution of Population Aged 3 Years and Above by School Attendance Status, Sex and Special Age Groups
V4_T2.6b V4 Table 2.6b Distribution of Population Aged 3 Years and Above by School Attendance Status, Sex, Special Age Groups and County..
V4_T2.7 V4 Table 2.7 Distribution of Population Aged 15 years and Above by Sex and Main Training Acquired and Qualified for
V4_T2.8a V4 Table 2.8a Distribution of Population Aged 5 Years and above by Activity Status, Sex, County and Sub-County
V4_T2.8b V4 Table 2.8b Distribution of Urban Population Aged 5 Years and above by Activity Status, Sex, County and Sub-County…..
V4_T2.8c V4 Table 2.8c Distribution of Rural Population Aged 5 Years and above by Activity Status, Sex, County and Sub-County..
V4_T2.9a V4 Table 2.9a Distribution of Population Aged 5 years and above by Activity Status, Broad Age Groups and County..
V4_T2.9b V4 Table 2.9b Distribution of Rural Population Aged 5 years and above by Activity Status, Broad Age Groups and County…….
V4_T2.9c V4 Table 2.9c Distribution of Urban Population Aged 5 years and above by Activity Status, Broad Age Groups and County…….
V4_T2.10 V4 Table 2.10 Distribution of Households and Tenure Status of Main Dwelling Unit by Area of Residence, County and Sub-County
V4_T2.11a V4 Table 2.11a Distribution of Households Owning the Main Dwelling Unit by Mode of Acquisition, Area of Residence, County and Sub-County
V4_T2.11b V4 Table 2.11b Distribution of Households Renting/Provided with their Main Tenure Status of Main Dwelling Unit by Provider, Area of Residence, County and Sub- County..
V4_T2.12 V4 Table 2.12 Percentage Distribution of Conventional Households by Dominant Roofing Material of Main Dwelling Unit, Area of Residence, County and Sub-County…..
V4_T2.13 V4 Table 2.13 Percentage Distribution of Conventional Households by Dominant Wall Material of Main Dwelling Unit, Area of Residence, County and Sub-County…….
V4_T2.14 V4 Table 2.14 Percentage Distribution of Conventional Households by Dominant Floor Material of the Main Dwelling Unit, Area of Residence, County and Sub County……
V4_T2.15 V4 Table 2.15 Percentage Distribution of Conventional Households by Main Source of Drinking Water, Area of Residence, County and Sub-County..
V4_T2.16 V4 Table 2.16 Percentage Distribution of Conventional Households by Main Mode of Human Waste Disposal, Area of Residence, County and Sub-County..
V4_T2.17 V4 Table 2.17 Percentage Distribution of Conventional Households by Main Mode of Solid Waste Disposal, Area of Residence, County and Sub-County..
V4_T2.18 V4 Table 2.18 Percentage Distribution of Conventional Households by Main Type of Cooking Fuel, Area of Residence, County and Sub-County….
V4_T2.19 V4 Table 2.19 Percentage Distribution of Conventional Households by Main Type of Lighting Fuel, Area of Residence, County and Sub-County….
V4_T2.20 V4 Table 2.20 Distribution of households practicing Agriculture, Fishing and Irrigation by County and Sub County.
V4_T2.21 V4 Table 2.21 Distribution of Households Growing Permanent Crops by Type and County.
V4_T2.22 V4 Table 2.22 Distribution of Households Growing Other Crops by Type, County and Sub County
V4_T2.23 V4 Table 2.23 Distribution of Households Rearing Livestock and Fish by County and Sub County.
V4_T2.24 V4 Table 2.24 Distribution of Livestock population by type, Fish Ponds and Fish Cages by County and Sub County..
V4_T2.25 V4 Table 2.25 Distribution of area (hectares) of Agricultural land and Farming Households by purpose of production, County and Sub-County..
V4_T2.26 V4 Table 2.26 Distribution of Population aged 5 years and above by Disability Status, Sex1, Area of Residence, County and Sub-County….
V4_T2.27 V4 Table 2.27 Distribution of Persons with Disability by Type of Disability, Sex1, Area of Residence, County and Sub County…
V4_T2.28 V4 Table 2.28 Distribution of Persons with Albinism by Sex1, Area of Residence, County and Sub County..
V4_T2.29 V4 Table 2.29 Population of Street Persons/Outdoor Sleepers by Sex1, Area of Residence and County.
V4_T2.30 V4 Table 2.30 Distribution of Population by Religious Affiliation and County
V4_T2.31 V4 Table 2.31 Distribution of Population by Ethnicity/Nationality
V4_T2.32 V4 Table 2.32 Distribution of Population Age 3 years and Above Owning a Mobile Phone by Area of Residence, Sex, County and Sub County
V4_T2.33 V4 Table 2.33 Distribution of Population Age 3 Years and Above Using Internet and Computer/Laptop/Tablet by Area of Residence, Sex, County and Sub-County…
V4_T2.34 V4 Table 2.34 Distribution of Population age 15 years and above who Searched and Bought Goods and Services Online by Area of Residence, Sex, County and Sub-County.
V4_T2.35 V4 Table 2.35 Distribution of Population Age 3 years and Above who owned and used Selected ICT Equipment and Service by Age, Area of Residence and County..
V4_T2.36 V4 Table 2.36 Percentage Distribution of Conventional Households by Ownership of Selected Household Assets by Area of Residence, County and Sub County…
V4_T2.37 V4 Table 2.37 Births in the Last 12 months* by place of Occurrence and County…
V4_T2.38 V4 Table 2.38 Births in the Last 5 Years* by place of Occurrence and County
V4_T2.39 V4 Table 2.39 Notified Births in the Last 12 months by County
V4_T2.40 V4 Table 2.40 Notified Births in the Last 5 Years by County
county <- rKenyaCensus::V3_T1.2
View(county)
#urban <- rKenyaCensus::V2_T2.5
#View(urban)
school <- rKenyaCensus::V4_T2.3
View(school)
#croptype <-rKenyaCensus::V4_T2.21
#View(croptype)
online <-rKenyaCensus::V4_T2.34
View(online)
land <- rKenyaCensus::V1_T2.4
View(land)

ggplot

library(dplyr)
library(ggrepel)
## Warning: package 'ggrepel' was built under R version 4.0.3
Plot1 <- dplyr::bind_cols(land,crops)
#ggplot(Plot1, aes(x=`LandArea(in Sq. Km)`, y = Farming, size = `Population Density(No. per Sq. Km)`)) + geom_point(position = "jitter", color = "blue") + coord_cartesian(xlim = c(-10000,75000), ylim = c(0,400000)) + scale_size(range = c(.1, 14)) + geom_text(aes(label=ifelse(Farming>100000,as.character(County),'')),hjust=0, vjust=0)
ggplot(Plot1, aes(x=`LandArea(in Sq. Km)`, y = Farming, size = `Population Density(No. per Sq. Km)`)) + geom_point(position = "jitter", color = "blue") + coord_cartesian(xlim = c(-10000,75000), ylim = c(0,400000)) + scale_size(range = c(.1, 14)) + geom_label_repel(aes(label=ifelse(Farming>200000,as.character(County),''),
                  box.padding   = 0.2, 
                  point.padding = 0.2,
                  segment.color = 'grey50')) 
## Warning: Ignoring unknown aesthetics: box.padding, point.padding, segment.colour

#ggplot(Plot1, aes(x=`LandArea(in Sq. Km)`, y = Farming, size = `Population Density(No. per Sq. Km)`)) + geom_point(position = "jitter", color = "blue") + coord_cartesian(xlim = c(-10000,75000), ylim = c(0,400000)) + scale_size(range = c(.1, 14))

R Markdown