Skip to content

IPUMS-Global-Health/ined-pma-2022

Repository files navigation

July 2022 INED Data Analysis Workshop

Linking health survey data with different climate datasets in R

July 6, 2022 14:00 - 16:00 (GMT+2)

Welcome! This repository contains presentation slides, data, and analysis code from the coding workshop hosted on July 6, 2022. Setup instructions are shown below. If you have any questions, please contact Matt Gunther directly.

All data and software (R) featured in this workshop are available free of charge.

‼️ Please Complete Setup Before the Workshop Begins

Setup:

  1. Download and Install RStudio (and R) if you do have not already done so.
  2. Install the spatial analysis tools GEOS, GDAL, and PRØJ using the appropriate instructions for your operating system.
    • Windows: Install RTools. All three spatial analysis tools will be included.
    • MacOS Follow these instructions to install GDAL using Homebrew, and then continue the instructions for installing sf and rgdal in R (GEOS and PRØJ will be installed automatically).
    • Linux Follow the appropriate instructions for your Linux distribution shown here.
  3. Clone this repository, or simply click here to download.
    • 📂 Windows users may need to download decompression software (e.g. 7-Zip).
  4. Create a data extract from IPUMS PMA with the following elements (visit the IPUMS PMA Youtube Channel for detailed instructions on each step):
    • Register for a free IPUMS PMA account - give a brief description of your research interests and be sure to select Burkina Faso when prompted
    • Click here to begin a new data extract by selecting samples:
      • Select the buttons for Longitudinal and Wide format
      • Check the box for Burkina Faso
      • Select the button for Sample Members: Female Respondents
    • Next, add the following variables to your Data Cart:
    • Follow these instructions to download both files necessary to import the data extract into R
      • You must download both the .dat.gz and .xml files
      • Save both files into this project's data subfolder
  5. Open the file ined-pma-2022.Rproj included in this project folder
    • 🚀 this will open RStudio in a new project environment.
  6. Copy the following code into the Console in RStudio, then press Enter.
    • ⌛ it may take several minutes to install the packages needed for this workshop!
    • Update any packages if prompted.
    • Reply "No" to Do you want to install from sources the package which needs compilation?.
    • Recommended: Restart R at least once before the workshop begins.
# Install any necessary packages if not already installed 

for(
 pkg in c(
   "tidyverse", "ipumsr", "sf", "terra", "ggspatial", "gtools",
   "srvyr", "survey", "lme4", "broom.mixed", "broom", "remotes"
 )
){if(!require(pkg, quietly = TRUE, character.only = TRUE)){install.packages(pkg)}}

# Install a development version of `ggspatial` that plots raster data from `terra`
# See https://github.com/paleolimbot/ggspatial/

if(packageVersion("ggspatial") != '1.1.5.9000'){
 remotes::install_local("cellar/ggspatial_1.1.5.9000.tar.gz")
}

Slides and Source Code

Click here for slides shown in the workshop (built with Quarto and Revealjs)

Source code is included in the file analysis.Rmd