R Integration¶
This is s aguide of accessing data from the warehouse using R programming language. These examples will help you get started with reading the API's and working with health data from the warehouse.
What You Can Do With R¶
Using R with API's from the warehouse allows you to:
- Import datasets directly into RStudio or R console
- Perform statistical analysis using R's extensive statistical packages
- Create professional visualizations with ggplot2
- Generate reports with R Markdown
- Conduct epidemiological analyses
Getting Started¶
Required R Packages¶
Install these commonly used packages for data analysis:
# Install required packages (run this once)
install.packages(c("tidyverse", "dplyr", "ggplot2", "data.table"))
# Load packages
library(tidyverse)
library(dplyr)
library(ggplot2)
Basic Data Access¶
Here are two easy ways to get data from CEMA Warehouse:
Method 1: Using readr¶
library(httr)
library(jsonlite)
library(tidyverse)
# Get dataset
health_data <- read_csv("https://warehouse.cema.africa/api/data/Health%20Work%20Force/table2/County_health_workforce?format=csv")
head(health_data)
Method 2: Using fread¶
library(data.table)
# Load health systems data
health_data <- fread("https://warehouse.cema.africa/api/data/Health%20Work%20Force/table2/County_health_workforce?format=csv")
head(health_data)
Getting Help¶
If you run into issues:
- Verify you copied the correct API link - go to the category specific tabs to verify
- Verify dataset names - use CAIA Assistant to find correct names
- Test with simple examples first - make sure basic access works
- Contact support if you need help with specific datasets