Learn R Programming

migest (version 2.0.2)

index_intensity: Summary indices of migration intensity

Description

Summary indices of migration intensity

Usage

index_intensity(mig_total = NULL, pop_total = NULL, n = NULL, long = TRUE)

Value

A tibble with 2 summary measures where

cmp

Crude migration probability from Bell et. al. (2002), sometimes known as crude migration intensity, e.g. Bernard (2017)

courgeau_k

Intensity measure of Courgeau (1973)

Arguments

mig_total

Numeric value for the total number of migrations.

pop_total

Numeric value for the total population.

n

Numeric value for the number of regions used in the definition of migration for mig_total.

long

Logical to return a long data frame with index values all in one column

Examples

Run this code
# single year
library(dplyr)
m <- korea_reg %>%
  filter(year == 2020,
         orig != dest) %>%
  pull(flow) %>%
  sum()
m
p <- korea_pop %>%
  filter(year == 2020) %>%
  pull(population) %>%
  sum()
p
index_intensity(mig_total = m, pop_total = p, n = n_distinct(korea_pop$region))

# multiple years
mm <- korea_reg %>%
  group_by(year) %>%
  filter(orig != dest) %>%
  summarise(m = sum(flow))
mm
pp <- korea_pop %>%
  group_by(year) %>%
  summarise(p = sum(population))
pp

library(purrr)
library(tidyr)
mm %>%
  left_join(pp) %>%
  mutate(i = map2(.x = m, .y = p,
                  .f = ~index_intensity(mig_total = .x,
                                        pop_total = .y,
                                        n = n_distinct(korea_pop$region),
                                        long = FALSE))) %>%
  unnest(cols = i)

Run the code above in your browser using DataLab