knitr::opts_chunk$set(
  collapse  = TRUE,
  fig.align = "center",
  comment   = "#>"
)

knitr::opts_chunk$set(
  echo      = TRUE)

{migratr}

A set of tools for unifying {sf} and {igraph} object for geospatial network analysis.

Install

First, if you haven’t done so, install remotes:

install.packages("remotes")

Proceed to install {migratr} from Github:

remotes::install_github("cjcallag/migratr")

Example: All Populations

The goal is to create representations of network both projected over a map or as a sociogram. Because the network is the unit of analysis, the functions are designed to work with both a edge and node list.

First, load the package and any other tools you may require (I suggest using {tidyverse} tools for data manipulation):

library(migratr)
library(tidyverse)

Now load the sample node and edge lists:

edges <- migratr::edgelist
nodes <- migratr::nodelist
glimpse(edges)
glimpse(nodes)

Using the edge and node list produce a new object with relationships and geographic data:

migratr_object <- migratr::get_proto_graph(edges = edges[edges["edge_type"] == "Adjacency/Population",],
                                           nodes = nodes)
migratr_object

Plot migratr_object:

plot(migratr_object)

Example: The Kurds

Load required data:

edges <- migratr::kurds_edgelist
glimpse(edges)
nodes <- migratr::kurds_nodelist
glimpse(nodes)

Using the edge and node list produce a new object with relationships and geographic data:

migratr_object <- migratr::get_proto_graph(edges = edges,
                                           nodes = nodes)
migratr_object

Plot migratr_object:

plot(migratr_object)


cjcallag/migratr documentation built on Dec. 15, 2019, 9:42 p.m.