knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

pipload

Codecov test coverage

The goal of pipload is to provide a series of tools to load into memory the PIP microdata. You can load and update the inventory of PIP microdata, as well as find the data most recent version of each country-year-survey data point.

Installation

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("PIP-Technical-Team/pipload")

Example

Load library

library(pipload)

Microdata

Load Two datasets for Paraguay for the Poverty Calculator tool:

# Find the data available. 
df <- pip_find_data(
             country = "PRY",
             year    = c(2017, 2018),
             tool    = "PC"
)

df$filename

# load the data
df2 <- pip_find_data(
             country = "PRY",
             year    = c(2017, 2018),
             tool    = "PC"
)

names(df2)

load Auxiliary data

Load different types of auxiliary data

# Load CPI
df <- pip_load_aux("cpi")
head(df)

# load PPP
df <- pip_load_aux("ppp")
head(df)

# Load GDP
df <- pip_load_aux("gdp")
head(df)

measure <- "cpi"

# see versions available
df      <- pip_load_aux(measure, version = "available")
df

# Load version of "2020-08-07 10:15:48 EDT"
df      <- pip_load_aux(measure, version = "20220223154416")
head(df)

# Load one version before current one (i.e., load previous version)
df      <- pip_load_aux(measure, version = -1)
head(df)

Inventory of microdata

Check if inventory is up to data and udpate

# Update inventory of PRY

# pip_inventory("update", country = "PRY")

# Load inventory
df <- pip_inventory()
df$filename[1:5]


PIP-Technical-Team/pipload documentation built on March 22, 2022, 3:22 a.m.