worldbank

R client for the World Bank APIs

https://github.com/m-muecke/worldbank

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.6%) to scientific vocabulary

Keywords

api indicators poverty r r-package worldbank worldbank-api
Last synced: 6 months ago · JSON representation

Repository

R client for the World Bank APIs

Basic Info
Statistics
  • Stars: 5
  • Watchers: 2
  • Forks: 0
  • Open Issues: 1
  • Releases: 6
Topics
api indicators poverty r r-package worldbank worldbank-api
Created about 2 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog License

README.Rmd

---
output: github_document
---



```{r}
#| include: false
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
options(str = strOptions(strict.width = "cut"))
```

# worldbank


[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![R-CMD-check](https://github.com/m-muecke/worldbank/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/m-muecke/worldbank/actions/workflows/R-CMD-check.yaml)
[![CRAN status](https://www.r-pkg.org/badges/version/worldbank)](https://CRAN.R-project.org/package=worldbank)
[![R-universe version](https://m-muecke.r-universe.dev/worldbank/badges/version)](https://m-muecke.r-universe.dev/worldbank)


## Overview

worldbank provides a simple interface to the following [World Bank](https://datahelpdesk.worldbank.org/knowledgebase/articles/889386-developer-information-overview) APIs:

- [Indicators API v2](https://datahelpdesk.worldbank.org/knowledgebase/articles/889392-about-the-indicators-api-documentation)
- [Poverty and Inequality Platform (PIP) API](https://pip.worldbank.org/api).
- [Finances One API](https://financesone.worldbank.org)

The main difference to other packages is that it's a modern implementation using the [httr2](https://httr2.r-lib.org) package
and supports all available endpoints and parameters.

## Installation

You can install the released version of **worldbank** from [CRAN](https://CRAN.R-project.org) with:

```{r}
#| eval: false
install.packages("worldbank")
```

And the development version from [GitHub](https://github.com/) with:

```{r}
#| eval: false
# install.packages("pak")
pak::pak("m-muecke/worldbank")
```

## Usage

worldbank functions are prefixed with `wb_` and follow the naming convention of the [World Bank API v2](https://datahelpdesk.worldbank.org/knowledgebase/articles/889392-about-the-indicators-api-documentation).

```{r}
#| label: demo
#| message: false
#| dpi: 300
library(worldbank)

# filter by specific country
wb_country(c("US", "DE"))

# or fetch all (default)
country <- wb_country()
str(country)

# search for specific indicator
ind <- wb_indicator()
ind <- subset(
  ind,
  grepl("GDP", id, fixed = TRUE) & source_value == "World Development Indicators"
)
str(ind)

# fetch indicator data for specific or all countries (default)
gdp <- wb_data("NY.GDP.MKTP.CD", c("US", "DE", "FR", "CH", "JP"))
str(gdp)

# plot the indicator data
library(ggplot2)

subset(gdp, date >= 1980) |>
  ggplot(aes(x = date, y = value, color = country_name)) +
  geom_line() +
  theme_minimal() +
  theme(
    legend.title = element_blank(),
    legend.position = "bottom",
    plot.title = element_text(face = "bold"),
    panel.grid.major.y = element_line(color = "black", linewidth = 0.2),
    panel.grid.major.x = element_blank(),
    panel.grid.minor = element_blank(),
    axis.text = element_text(color = "black"),
    axis.title = element_blank()
  ) +
  scale_y_continuous(
    labels = scales::label_currency(scale_cut = scales::cut_short_scale())
  ) +
  labs(title = "GDP in Current U.S. Dollars", color = "Country")
```

## Related work

* [WDI](https://github.com/vincentarelbundock/WDI): R package to download World Bank data
* [pipr](https://github.com/worldbank/pipr): R client for the PIP Worldbank API
* [wbstats](https://github.com/gshs-ornl/wbstats): R package for searching and downloading data from the World Bank API
* [wbwdi](https://github.com/tidy-intelligence/r-wbwdi): R package to download World Bank indicator data

Owner

  • Name: Maximilian Mücke
  • Login: m-muecke
  • Kind: user
  • Location: Munich, Germany

GitHub Events

Total
  • Create event: 12
  • Release event: 1
  • Issues event: 11
  • Delete event: 10
  • Push event: 127
  • Pull request event: 28
Last Year
  • Create event: 12
  • Release event: 1
  • Issues event: 11
  • Delete event: 10
  • Push event: 127
  • Pull request event: 28

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 19
  • Total pull requests: 30
  • Average time to close issues: 2 months
  • Average time to close pull requests: about 9 hours
  • Total issue authors: 2
  • Total pull request authors: 4
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 27
  • Bot issues: 0
  • Bot pull requests: 28
Past Year
  • Issues: 5
  • Pull requests: 19
  • Average time to close issues: about 9 hours
  • Average time to close pull requests: about 14 hours
  • Issue authors: 2
  • Pull request authors: 4
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 16
  • Bot issues: 0
  • Bot pull requests: 17
Top Authors
Issue Authors
  • m-muecke (18)
  • christophscheuch (1)
Pull Request Authors
  • dependabot[bot] (15)
  • pre-commit-ci[bot] (13)
  • robjhyndman (1)
  • m-muecke (1)
Top Labels
Issue Labels
Pull Request Labels
dependencies (15) github_actions (1)

Packages

  • Total packages: 1
  • Total downloads:
    • cran 524 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 7
  • Total maintainers: 1
cran.r-project.org: worldbank

Client for World Banks's 'Indicators' and 'Poverty and Inequality Platform (PIP)' APIs

  • Versions: 7
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 524 Last month
Rankings
Dependent packages count: 28.6%
Dependent repos count: 35.2%
Average: 50.1%
Downloads: 86.6%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.4.1 composite
  • actions/checkout v3 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pr-commands.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/pr-fetch v2 composite
  • r-lib/actions/pr-push v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran
  • R >= 4.1.0 depends
  • httr2 * imports
  • testthat >= 3.0.0 suggests
  • tibble * suggests