I am currently writing a paper on the international flows of migration and remittances for university. I am conducting a network analysis and have received some interesting results. I would like to visualize some edges/flows of migration/remittances on a world map, but I do not know how.
I extracted the edges I would like to visualize to a data.frame with the following columns: From, To, Weight
For example: (From) Afghanistan, (To) Pakistan, (Weight) XXXX
I assume that I would have to add the corresponding longitude and latitude to the rows through a conditional order. I have already obtained the country centroids from Harvard WorldMap. How do I add them to the countries to show them on the world map? Is that possible? In addition, some countries are named a bit differently, like Congo (rep./Republic of et cetera).
I am new to the world of R and Network Analysis. I come from Germany, so I apologise for my English language skills. I am looking forward to your advise!
The {sf} package provides an approach. It provides the spatial geometry as a variable in a data frame than can be joined by applicable country codes with data frames such as this one.
Labeling and positioning according to centroid (which is calculated without having to be specified externally) can be placed on a second layer.
The edge repre
There sf_geom methods to carry out the project in layers.
Project mutlipolygons representing country outlines according to a Mercator (or preferably less biased) projection of the geoid
Prepare the 197^2 matrix of node/weights (representing the possible edge) as a column of countries to match the rows of countries. The diagonal, of course, will be zero.
Decide on whether to project the edges as straight lines or great circles, and extract line geometries from the corresponding pairs of geometry objects in the combined data frame.