Skip to content

dataobservatory-eu/wbdataset

Repository files navigation

wbdataset

Lifecycle: experimental CRAN status [DOI] Codecov test coverage

The goal of wbdataset is to create tidy datasets from Wikidata or a Wikibase instance. The wbdataset package is an extension of the dataset, which in turn is an R package that helps to exchange, publish and combine datasets more easily by improving their semantics. The wbdataset extends the usability of dataset by connecting the Wikibase API with the R statistical environment.

Installation

You can install the development version of wbdataset from GitHub with:

# install.packages("devtools")
devtools::install_github("antaldaniel/dataset")
devtools::install_github("dataobservatory-eu/wbdataset")
library(wbdataset)

Example

This is a basic example which shows you how to solve a common problem:

library(wbdataset)
small_countries_dataset <- get_wikidata_item(
  qid = c("Q228", "Q347"),
  language = c("en", "nl"),
  data_curator = person("Jane Doe"),
  title = "Small Countries"
)
#> Downloaded Q228
#> Downloaded Q347

small_countries_dataset
#> Jane Doe (????). "Small Countries."
#>   rowid      qid_on_wikidata label         description                  language
#>   <hvn_lbl_> <hvn_lbl_>      <hvn_lbl_>    <hvn_lbl_>                   <hvn_lb>
#> 1 eg:1       Q228            Andorra       sovereign microstate betwee… en      
#> 2 eg:2       Q228            Andorra       land in Europa               nl      
#> 3 eg:3       Q347            Liechtenstein country in Central Europe    en      
#> 4 eg:4       Q347            Liechtenstein land in Europa               nl

The wbdataset package has three tutorial articles: