Package {kpp2019}


Title: Kenya Population Projections 2019
Version: 0.0.1
Description: Provides population projection data for Kenya and its 47 counties from 2020 to 2045, derived from the 2019 Kenya Population and Housing Census and subsequent projections published by the Kenya National Bureau of Statistics (KNBS). Includes annual and five-year age and sex distributions, along with components of population change such as births, deaths, and migration.
License: CC BY 4.0
URL: https://kpp2019.damurka.com, https://github.com/damurka/kpp2019
BugReports: https://github.com/damurka/kpp2019/issues
Suggests: dplyr, ggplot2, knitr, purrr, readxl, rmarkdown, spelling, stringr, tidyr, testthat (≥ 3.0.0)
Depends: R (≥ 2.10)
Config/testthat/edition: 3
Encoding: UTF-8
Language: en-GB
LazyData: true
Config/roxygen2/version: 8.0.0
NeedsCompilation: no
Packaged: 2026-08-19 12:07:26 UTC; Murage
Author: David Kariuki ORCID iD [aut, cre, cph]
Maintainer: David Kariuki <hello@damurka.com>
Repository: CRAN
Date/Publication: 2026-08-20 14:10:09 UTC

kpp2019: Kenya Population Projections 2019

Description

logo

Provides population projection data for Kenya and its 47 counties from 2020 to 2045, derived from the 2019 Kenya Population and Housing Census and subsequent projections published by the Kenya National Bureau of Statistics (KNBS). Includes annual and five-year age and sex distributions, along with components of population change such as births, deaths, and migration.

Author(s)

Maintainer: David Kariuki hello@damurka.com (ORCID) [copyright holder]

Authors:

See Also

Useful links:


Components of Population Change in Kenya (2020-2045)

Description

This dataset provides components of population change in Kenya over several 5-year projection periods from 2020 to 2045. The dataset includes key demographic components such as births, deaths, natural increase, and migration, along with related population rates such as crude birth rate, crude death rate, natural increase rate, and net migration rate. The data is structured for each projection period.

Usage

components

Format

A data frame with 1,920 rows and 4 variables:

county

Name of the county (factor).

component

The demographic component being measured (factor). Possible values include:

Births

The total number of births during the projection period.

Deaths

The total number of deaths during the projection period.

Nat. Inc.

Natural Increase: the difference between births and deaths during the projection period.

Net Mig.

Net Migration: the net number of people entering or leaving Kenya during the projection period (immigrants minus emigrants).

CBR

Crude Birth Rate: the number of births per 1,000 population per year during the projection period.

CDR

Crude Death Rate: the number of deaths per 1,000 population per year during the projection period.

CNIR

Crude Natural Increase Rate: the difference between the crude birth rate and crude death rate, representing natural population growth per 1,000 population per year.

CNMR

Crude Net Migration Rate: the net migration rate, representing the net number of migrants per 1,000 population per year.

year

The 5-year projection period (factor). Possible values are "2020-25", "2026-30", "2031-35", "2036-40", and "2041-45".

value

The numeric value associated with the component for the specific projection period (numeric).

Details

This dataset captures various components of population change for Kenya from 2020 to 2045. It allows users to analyze demographic changes over time, including the impacts of births, deaths, migration, and natural increase on population size. The rates, such as the crude birth rate (CBR) and crude death rate (CDR), provide insights into demographic trends per 1,000 population.

value is kept at the full decimal precision published by KNBS (these are cohort-component projections, not rounded figures); round it yourself if whole-number figures are needed.

Components Explained:

Source

Kenya National Bureau of Statistics (2023). 2019 Kenya Population and Housing Census Analytical Report on Population Projections. Retrieved from knbs.or.ke.

Examples

data(components)
head(components)
summary(components)

# Example: Plot the number of births over the projection periods for Kenya
if (requireNamespace("ggplot2", quietly = TRUE) &&
    requireNamespace("dplyr", quietly = TRUE)) {
  library(ggplot2)
  library(dplyr)
  births <- components %>%
    filter(component == "Births", county == 'Kenya')
  ggplot(births, aes(x = factor(year, ordered = TRUE), y = value, group = county)) +
    geom_line() +
    geom_point() +
    labs(
      title = "Projected Births in Kenya (2020-2045)",
      x = "Projection Period",
      y = "Number of Births"
    ) +
    theme_minimal()
}

Base and Projected Age Distributions in Kenya (2020-2035, Annual Increments)

Description

This dataset provides base and projected population distributions by county, age group, gender, and year for Kenya from 2020 to 2035 in annual increments. It includes population estimates derived from the 2019 Kenya Population and Housing Census and subsequent projections by the Kenya National Bureau of Statistics (KNBS).

Usage

pop1

Format

A data frame with 41,472 rows and 5 variables:

county

Name of the county in Kenya

age

Age group in 5-year intervals (e.g., "0-4", "5-9", ..., "80+")

year

Year of the population estimate

gender

Gender category ("Male", "Female", or "Total")

pop

Estimated population for the specified county, age group, gender, and year

Details

The pop1 dataset can be used to analyse demographic trends, plan resource allocation, and study population dynamics in Kenya over the specified years. The projections take into account factors such as fertility rates, mortality rates, and migration patterns. The age groups are provided in 5-year intervals, and the population estimates are updated annually from 2020 to 2035.

pop is kept at the full decimal precision published by KNBS (these are cohort-component projections, not rounded head counts); round it yourself if whole-person figures are needed.

Note:

Source

Kenya National Bureau of Statistics (2023). 2019 Kenya Population and Housing Census Analytical Report on Population Projections. Retrieved from knbs.or.ke.

Examples

data(pop1)
head(pop1)
summary(pop1)

# Example: Plotting the population distribution for Nairobi County in 2020
if (requireNamespace("ggplot2", quietly = TRUE) &&
    requireNamespace("dplyr", quietly = TRUE)) {
  library(ggplot2)
  library(dplyr)
  kenya_2020 <- pop1 %>%
    filter(county == "Nairobi City", year == 2020, gender == "Total", age != 'All Ages')
  ggplot(kenya_2020, aes(x = age, y = pop)) +
    geom_bar(stat = "identity") +
    labs(
      title = "Population Distribution in Nairobi County (2020)",
      x = "Age Group",
      y = "Population"
    ) +
    theme_minimal()
}

Base and Projected Age Distributions in Kenya (2020-2045, Five-Year Increments)

Description

This dataset provides base and projected population distributions by county, age group, gender, and year for Kenya from 2020 to 2045 in five-year increments. It includes population estimates derived from the 2019 Kenya Population and Housing Census and subsequent projections by the Kenya National Bureau of Statistics (KNBS).

Usage

pop5

Format

A data frame with 15,552 rows and 5 variables:

county

Name of the county in Kenya

age

Age group in 5-year intervals (e.g., "0-4", "5-9", ..., "80+")

year

Year of the population estimate

gender

Gender category ("Male", "Female", or "Total")

pop

Estimated population for the specified county, age group, gender, and year

Details

The pop5 dataset can be used to analyse demographic trends, plan resource allocation, and study population dynamics in Kenya over the specified years. The projections take into account factors such as fertility rates, mortality rates, and migration patterns. The age groups are provided in 5-year intervals, and the population estimates are available in five-year increments from 2020 to 2045.

pop is kept at the full decimal precision published by KNBS (these are cohort-component projections, not rounded head counts); round it yourself if whole-person figures are needed.

Note:

Source

Kenya National Bureau of Statistics (2023). 2019 Kenya Population and Housing Census Analytical Report on Population Projections. Retrieved from knbs.or.ke.

Examples

data(pop5)
head(pop5)
summary(pop5)

# Example: Plotting the population distribution for Mombasa County in 2025
if (requireNamespace("ggplot2", quietly = TRUE) &&
    requireNamespace("dplyr", quietly = TRUE)) {
  library(ggplot2)
  library(dplyr)
  mombasa_2025 <- pop5 %>%
    filter(county == "Mombasa", year == 2025, gender == "Total", age != 'All Ages')
  ggplot(mombasa_2025, aes(x = age, y = pop)) +
    geom_bar(stat = "identity") +
    labs(
      title = "Population Distribution in Mombasa County (2025)",
      x = "Age Group",
      y = "Population"
    ) +
    theme_minimal()
}