Chapter 1 Introduction

In many countries and regions throughout the world, human migration represents a major force of demographic, social and economic change. However, the underlying processes of migration are complex and data on the movements are often considered to be poor quality or limited in detail. Ideed, in many situations, migration data are completely missing or unusable for examining the patterns and consequences of interest. This is especially true for international migration. As a result, methods to estimate migration flows have been developed by demographers and other researchers to address shortfalls in data provision so that one can study the patterns, trends and consequences.

This manual covers a range of methods for handling, measuring, estimating, and visualizing migration data in R. These methods are based on several authoritative sources, including the UN DESA manuals on Methods of measuring internal migration and Preparing migration data for subnational population projections, as well as the migration chapters of the IUSSP Tools for Demographic Estimation. Additionally, recent developments in the field are included. By the end, you will have a comprehensive understanding of the various methods available for working with migration data in R, and how to apply them to your own research.

To make the most of this manual, we assume that you have basic knowledge of using R, especially the tidyverse set of packages. If you are not familiar with R or need a refresher, we recommend working your way through an online course before diving into this manual. Some good resources for learning R and the tidyverse include:

  • R for Data Science, a comprehensive guide to data science in R, covering data import and cleaning, data visualization, and statistical modeling.
  • DataCamp, an online learning platform that offers interactive courses on R programming and data science topics.
  • R Bootcamp, a free online course that covers the basics of R programming and the tidyverse.
  •, a website dedicated to the tidyverse packages with tutorials, articles, and other resources for learning and using them.
  • Swirl, an interactive learning platform within R that teaches you how to use R in a hands-on manner.

The above resources provide a comprehensive introduction to R programming and the tidyverse, which will be useful throughout this manual and in your future data analysis work.

The manual is organized into nine chapters, each covering a different aspect of handling, measuring, estimating, and visualizing migration data in R. Chapter 1 provides an introduction to migration data and concepts. Chapter 2 focuses on handling migration data in R. Chapter 3 covers summary migration indices. Chapter 4 is dedicated to estimating net migration. Chapter 5 focuses on describing and estimating migration age structures. Chapter 6 covers methods for describing bilateral migration data. Chapter 7 covers methods for estimating bilateral migration. Finally, Chapters 8 and 9 cover methods for visualizing bilateral migration, including chord diagrams and Sankey plots.

In each chapter, we provide code and data that will allow you to replicate the outputs we present, as well as exercises that allow you to practice the concepts and methods on your own. Solutions to these exercises are provided so you can check your work and ensure that you have a firm grasp of the material before moving on to the next chapter. By following the examples and completing the exercises in this manual, you will gain a deep understanding of how to handle, measure, estimate, and visualize migration data in R.