Merging DHS data with Shape file

I am trying to merge DHS survey data with shape file. I am very beginner in R, therefore any help to complete this task is much appreciated.
Would anybody have necessary code to do this job and could possible to share with me?
Thanks in advance.

This is a rather broad question; difficult to answer.

In principle: joining data to shapefiles is an easy thing to do in the workflow of sf package - as the sf objects are data frames, so the usual tidyverse suspects such as inner_join() apply. Workflow based on the older sp package is somewhat more challenging, but still doable (if I remember correctly the trick was to link based on a key value instead of just position; but I have not used the sp workflow for some time).

The difficult part is getting hold of an appropriate shapefile, which I can not help you with as the question stands, as I do not know what region / administrative units your data applies to.

EDIT: a while back I have written a package with sf objects of shape objects for the Czech Republic, including administrative regions. Attaching census data and drawing a choropleth chart is the #1 example covered by its vignette - have look if wou wish

1 Like