wbstats

wbstats: An R package for searching and downloading data from the World Bank API

https://github.com/gshs-ornl/wbstats

Science Score: 23.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
  • DOI references
  • Academic publication links
  • Committers with academic emails
    2 of 4 committers (50.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.0%) to scientific vocabulary

Keywords

open-data r r-package rstats world-bank world-bank-api worldbank
Last synced: 6 months ago · JSON representation

Repository

wbstats: An R package for searching and downloading data from the World Bank API

Basic Info
Statistics
  • Stars: 127
  • Watchers: 11
  • Forks: 23
  • Open Issues: 17
  • Releases: 2
Topics
open-data r r-package rstats world-bank world-bank-api worldbank
Created almost 10 years ago · Last pushed about 2 years ago
Metadata Files
Readme License

README.Rmd

---
output:
  md_document:
    variant: markdown_github
---



```{r, echo = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/"
)
```

# wbstats: An R package for searching and downloading data from the World Bank API


[![CRAN status](https://www.r-pkg.org/badges/version/wbstats)](https://CRAN.R-project.org/package=wbstats)
[![Monthly](https://cranlogs.r-pkg.org/badges/wbstats)](https://CRAN.R-project.org/package=wbstats)
[![Lifecycle: maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)


You can install:

The latest release version from CRAN with
```{r, eval = FALSE}
install.packages("wbstats")
```

or

The latest development version from github with
```{r, eval = FALSE}
remotes::install_github("nset-ornl/wbstats")
```

# Downloading data from the World Bank

```{r readme-download, warning=FALSE}
library(wbstats)

# Population for every country from 1960 until present
d <- wb_data("SP.POP.TOTL")
    
head(d)
```


## Hans Rosling's Gapminder using `wbstats`

```{r readme-chart, warning=FALSE, message=FALSE, fig.width=12, fig.height=6}
library(tidyverse)
library(wbstats)

my_indicators <- c(
  life_exp = "SP.DYN.LE00.IN", 
  gdp_capita ="NY.GDP.PCAP.CD", 
  pop = "SP.POP.TOTL"
  )

d <- wb_data(my_indicators, start_date = 2016)

d %>%
  left_join(wb_countries(), "iso3c") %>%
  ggplot() +
  geom_point(
    aes(
      x = gdp_capita, 
      y = life_exp, 
      size = pop, 
      color = region
      )
    ) +
  scale_x_continuous(
    labels = scales::dollar_format(),
    breaks = scales::log_breaks(n = 10)
    ) +
  coord_trans(x = 'log10') +
  scale_size_continuous(
    labels = scales::number_format(scale = 1/1e6, suffix = "m"),
    breaks = seq(1e8,1e9, 2e8),
    range = c(1,20)
    ) +
  theme_minimal() +
  labs(
    title = "An Example of Hans Rosling's Gapminder using wbstats",
    x = "GDP per Capita (log scale)",
    y = "Life Expectancy at Birth",
    size = "Population",
    color = NULL,
    caption = "Source: World Bank"
  ) 
    
```



## Using `ggplot2` to map `wbstats` data

```{r ggplot2, fig.height=6, fig.width=8, fig.align="center", message=FALSE, warning=FALSE}
library(rnaturalearth)
library(tidyverse)
library(wbstats)

ind <- "SL.EMP.SELF.ZS"
indicator_info <- filter(wb_cachelist$indicators, indicator_id == ind)

ne_countries(returnclass = "sf") %>%
  left_join(
    wb_data(
      c(self_employed = ind), 
         mrnev = 1
          ),
    c("iso_a3" = "iso3c")
  ) %>%
  filter(iso_a3 != "ATA") %>% # remove Antarctica
  ggplot(aes(fill = self_employed)) +
  geom_sf() +
  scale_fill_viridis_c(labels = scales::percent_format(scale = 1)) +
  theme(legend.position="bottom") +
  labs(
    title = indicator_info$indicator,
    fill = NULL,
    caption = paste("Source:", indicator_info$source_org) 
  )
  
```

Owner

  • Name: Geospatial Science and Human Security at ORNL
  • Login: gshs-ornl
  • Kind: organization
  • Email: https://www.ornl.gov/
  • Location: Oak Ridge, Tennessee

Geospatial Science and Human Security Division at Oak Ridge National Laboratory

GitHub Events

Total
  • Issues event: 3
  • Watch event: 2
Last Year
  • Issues event: 3
  • Watch event: 2

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 138
  • Total Committers: 4
  • Avg Commits per committer: 34.5
  • Development Distribution Score (DDS): 0.072
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Jesse Piburn j****n@g****m 128
Jesse Piburn p****o@o****v 6
Petr Bouchal p****l@g****m 3
Brendan Apfeld b****d@u****u 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 43
  • Total pull requests: 5
  • Average time to close issues: 4 months
  • Average time to close pull requests: 8 months
  • Total issue authors: 32
  • Total pull request authors: 5
  • Average comments per issue: 1.58
  • Average comments per pull request: 1.0
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 6
  • Pull requests: 0
  • Average time to close issues: about 2 hours
  • Average time to close pull requests: N/A
  • Issue authors: 5
  • Pull request authors: 0
  • Average comments per issue: 0.17
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • vincentarelbundock (4)
  • greg-minshall (4)
  • jpiburn (3)
  • lucasmation (2)
  • morrisseyj (2)
  • joufeihuang (2)
  • rulla (1)
  • umbe1987 (1)
  • joachim-gassen (1)
  • ggrothendieck (1)
  • denironyx (1)
  • SebKrantz (1)
  • einian85 (1)
  • bramtayl (1)
  • petrbouchal (1)
Pull Request Authors
  • BroVic (1)
  • bapfeld (1)
  • jpiburn (1)
  • denironyx (1)
  • petrbouchal (1)
Top Labels
Issue Labels
enhancement (7) bug (3)
Pull Request Labels
enhancement (1)

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 2
proxy.golang.org: github.com/gshs-ornl/wbstats
  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.5%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.2 depends
  • dplyr * imports
  • httr * imports
  • jsonlite * imports
  • lifecycle * imports
  • lubridate * imports
  • magrittr * imports
  • readr * imports
  • rlang * imports
  • stringr * imports
  • tibble * imports
  • tidyr * imports
  • ggplot2 * suggests
  • knitr * suggests
  • markdown * suggests
  • rmarkdown * suggests