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.
Setup:
- Download and Install RStudio (and R) if you do have not already done so.
- 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
andrgdal
in R (GEOS and PRØJ will be installed automatically). - Linux Follow the appropriate instructions for your Linux distribution shown here.
- Clone this repository, or simply click here to download.
- 📂 Windows users may need to download decompression software (e.g. 7-Zip).
- 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
- You must download both the
- Open the file
ined-pma-2022.Rproj
included in this project folder- 🚀 this will open RStudio in a new project environment.
- Copy the following code into the
Console
in RStudio, then pressEnter
.- ⌛ 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")
}
Click here for slides shown in the workshop (built with Quarto and Revealjs)
Source code is included in the file analysis.Rmd