The World Bank maintains data on migration between countries, based on censuses and other information. These have been translated to an R format as MigrationFlows
in the DCFdevel
package.
Here’s a small sample of the data:
Referring to the sample, you can see that in year 2000 there were 24,118 males who moved from Poland to Kazakhstan. In that year, there were 2289 females who moved from Indonesia to Australia.
How many variables are there?
MigrationFlows
in “long” or “narrow” format with respect to the years?How many cases are there?
How many countries are there?
MigrationFlows
. Which variables will you use in from MigrationFlows
to construct the table with the results? What will be the variables in the result table?sum()
to add numbers together, group_by()
, summarize()
head()
or sample_n()
to display just a few rows of your result.How many migrants originated (that is, emigrants) in each country in 2000?
Which 5 countries had the largest number of emigrants? (Hint: arrange()
, desc()
)
In the result table, what will be the cases? Are they the same as the original table? What will be the variables? Which ones are the same as in the original table.
mutate()
and not summarize()
was used here.Is the select()
necessary to finding the outPercent
variable?
For each origin country, what is the largest destination?
For each destination country, what is the largest origin?
For each destination country, what are the two largest origin countries?
DataComputing::CountryData
to access population data.Make a map of the countries whose people flow into a country of your choice. You can Here’s the result for Canada. (Note: the logarithm of Y2000
is shown.)
Construct a data table indicating for each country pair whether emigration increased or not between 1990 and 2000.
Make a map showing the global pattern of the increase or decrease in emigration from each country.
Imagine what the output data table will look like. Will the variables be different? Will the meaning of the cases be different?
Make a directed network graph showing the flows among the major pairs.
For each pair of countries, find the ratio of immigration/emigration between them in year 2000.
Select a couple of dozen pairs with the ratio most similar to 1. Make a network diagram showing the relationship.
Countries where the size of the exchange is balanced to within a factor of 3.3. Red is for females; blue for males.