This document explains how to use json OCDS data in R.
To load json data in R, we can use the
fromJSON command from the
jsonlite package. For this example we will use sample data from Colombia, that you can download in this link.
Set your working directory and load the packages:
setwd("SET YOUR WORKING DIRECTORY")
1- Load the data with the
fromJSON command. Use the option
flatten=TRUE to flatten the json data into a list.
2- The list only has one element, a dataframe called releases that contains all the data. We extract it from the list with the command
data[["releases"]] and transform it into a tibble
3- Explore the structure of the dataframe. The releases dataframe has different list columns, each containing dataframes; these dataframes correspond to arrays in the json data.