owidR

An R Package for Importing Data from Our World in Data

https://github.com/piersyork/owidR

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
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.5%) to scientific vocabulary

Keywords

data data-visualisation economics r r-package
Last synced: 6 months ago · JSON representation

Repository

An R Package for Importing Data from Our World in Data

Basic Info
  • Host: GitHub
  • Owner: piersyork
  • License: other
  • Language: R
  • Default Branch: main
  • Homepage:
  • Size: 2.71 MB
Statistics
  • Stars: 122
  • Watchers: 4
  • Forks: 11
  • Open Issues: 5
  • Releases: 8
Topics
data data-visualisation economics r r-package
Created over 4 years ago · Last pushed 11 months ago
Metadata Files
Readme Changelog License

README.Rmd

---
title: "owidR"
output: github_document
always_allow_html: true
---

```{r, echo = FALSE, message=FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "##",
  fig.path = "inst/images/", fig.width=8.5, fig.asp=0.55, fig.align='center',
  message = FALSE
)

library(ggplot2)

ggplot2::theme_set(
  theme_minimal(base_family = "serif") %+replace%
    theme(text = element_text(colour = "#373737", size = 18),
          plot.title = element_text(size = "22", hjust = 0, vjust = 3.2, face = "bold"),
          plot.subtitle = element_text(hjust = 0, vjust = 3.5),
          plot.title.position = "plot",
          plot.caption.position = "plot",
          plot.caption = element_text(hjust = 0, size = 14, vjust = -1),
          legend.position = "right",
          axis.text = element_text(face = "plain"),
          axis.title.x = element_blank(),
          legend.title = element_blank(),
          panel.grid.major = element_line(linetype = "dashed"),
          panel.grid.minor = element_blank(),
          plot.margin = margin(11, 15, 8, 0),
          axis.line.x = element_line(colour = "#8e8e8e"),
          axis.ticks = element_line(colour = "#8e8e8e"))
)

```



![CRAN downloads](http://cranlogs.r-pkg.org/badges/grand-total/owidR) [![CRAN status](https://www.r-pkg.org/badges/version/owidR)](https://CRAN.R-project.org/package=owidR) 
[![R-CMD-check](https://github.com/piersyork/owidR/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/piersyork/owidR/actions/workflows/R-CMD-check.yaml)


This package acts as an interface to [Our World in Data](https://ourworldindata.org/) datasets, allowing for an easy way to search through data used in over 3,000 charts and load them into the R environment.

After some updates to the Our World in Data site, some of the previous parts of the package are no longer working. Please install the development version of the pacakage to maintain core functionality of the `owid()` function. The site also now provides an API, this may offer an easier way to download datasets into R without a dependency on this package. For example using just `data.table` you can easily download a specific dataset. See more information on the API here: [Our World in Data API](https://docs.owid.io/projects/etl/api/chart-api/#chart-data-api)  

```{r}
library(data.table)
life_expectancy <- fread("https://ourworldindata.org/grapher/life-expectancy.csv")
```


## Installation

To install from CRAN:

```{r eval=FALSE}
install.packages("owidR")
```

To install the development version from GitHub:

```{r eval = FALSE}
devtools::install_github("piersyork/owidR")
```

## Using the package

The main function in owidR is `owid()`, which takes a chart id and returns a data.table of the corresponding OWID dataset. To search for chart ids you can use `owid_search()` to list all the chart ids that match a keyword or regular expression.

## Example

Lets use the core functions to get data on how human rights have changed over time. First by searching for charts on human rights.

```{r example, eval = TRUE, message = FALSE}
library(owidR)

owid_search("human rights") # this function is no longer working

```

Let's use the v-dem human rights index dataset.

```{r example2, eval = TRUE, message = FALSE}

rights <- owid("human-rights-index-vdem", rename = "vdem_rights")

rights

```

ggplot2 makes it easy to visualise our data.

```{r plot}
library(ggplot2)
library(dplyr)

rights |> 
  filter(entity %in% c("United Kingdom", "France", "United States")) |> 
  ggplot(aes(year, vdem_rights, colour = entity)) +
  geom_line()
```

## COVID-19 Data

You can quickly download world covid-19 data, including vaccination rates, using `owid_covid()`.

```{r covid, eval=FALSE}
covid <- owid_covid()
```

## To-do

-   [ ] Add function to load multiple country datasets into one dataframe
-   [ ] Add caching of data (inc. backend)
-   [x] Remove interactive plotting to reduce dependencies
-   [ ] Create way to import owid explorers

GitHub Events

Total
  • Issues event: 1
  • Watch event: 5
  • Issue comment event: 6
  • Push event: 2
Last Year
  • Issues event: 1
  • Watch event: 5
  • Issue comment event: 6
  • Push event: 2

Committers

Last synced: 6 months ago

All Time
  • Total Commits: 197
  • Total Committers: 3
  • Avg Commits per committer: 65.667
  • Development Distribution Score (DDS): 0.335
Past Year
  • Commits: 4
  • Committers: 1
  • Avg Commits per committer: 4.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
piersyork 8****k@u****m 131
piersyork p****k@g****m 65
Edouard Mathieu e****t@p****e 1
Committer Domains (Top 20 + Academic)
pm.me: 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 9
  • Total pull requests: 2
  • Average time to close issues: 26 days
  • Average time to close pull requests: about 2 hours
  • Total issue authors: 8
  • Total pull request authors: 2
  • Average comments per issue: 1.89
  • Average comments per pull request: 1.5
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 3
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 3
  • Pull request authors: 0
  • Average comments per issue: 2.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • veggabo (2)
  • IvanWilli (1)
  • artod83 (1)
  • geertaarts (1)
  • aarondweinberg (1)
  • baifengbai (1)
  • luca-scr (1)
  • efsidi (1)
Pull Request Authors
  • veggabo (2)
  • edomt (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 3
  • Total downloads:
    • cran 713 last-month
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 1
    (may contain duplicates)
  • Total versions: 25
  • Total maintainers: 1
proxy.golang.org: github.com/piersyork/owidr
  • Versions: 8
  • 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
proxy.golang.org: github.com/piersyork/owidR
  • Versions: 8
  • 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
cran.r-project.org: owidR

Import Data from Our World in Data

  • Versions: 9
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 713 Last month
Rankings
Stargazers count: 3.5%
Forks count: 6.8%
Average: 16.2%
Downloads: 18.3%
Dependent repos count: 23.8%
Dependent packages count: 28.7%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.5.0 depends
  • curl * imports
  • dplyr * imports
  • forcats * imports
  • ggplot2 * imports
  • ggrepel * imports
  • grDevices * imports
  • htmltools * imports
  • httr * imports
  • jsonlite * imports
  • leaflet * imports
  • magrittr * imports
  • purrr * imports
  • readr * imports
  • rlang * imports
  • rvest * imports
  • scales * imports
  • sf * imports
  • stringr * imports
  • xml2 * imports
  • knitr * suggests
  • plm * suggests
  • rmarkdown * suggests
  • showtext * suggests
  • sysfonts * suggests
  • testthat >= 3.0.0 suggests
  • texreg * suggests
  • utils * suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v2 composite
  • actions/upload-artifact main composite
  • r-lib/actions/check-r-package v1 composite
  • r-lib/actions/setup-pandoc v1 composite
  • r-lib/actions/setup-r v1 composite
  • r-lib/actions/setup-r-dependencies v1 composite