README.md

boardgameatlasR

lifecycle

The goal of boardgameatlasR is to provide a basic API wrapper for querying the Board Game Atlas (BGA) search API, found at https://www.boardgameatlas.com/api.

BGA is an website that catalogs board game information and statistics, such as the mechanics, number of players, and playtime. BGA also includes metrics on review scores of the games, review text, recent comments of the game on www.reddit.com, and more. For full information on the API, please consult https://www.boardgameatlas.com/api/docs.

Installation

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("mdweisner/boardgameatlasr")

Example

This will be a basic example once I functionally install the package is a basic example:

library(dplyr)
library(kableExtra)
library(boardgameatlasR)
search_bga(limit=10, name = "Catan", name_fuzzy = TRUE, order_by = "popularity", ascending = FALSE, client_id_pat = Sys.getenv('BOARDGAMEATLAS_PAT')) %>%
  select(id, name, year_published) %>%
  kable("html") 
id name year\_published OIXt3DmJU0 Catan 1995 ULWQvi77f5 Catan: Junior NA iSVnYdrsZQ Rivals for Catan 2010 b7EIdXzESo Starfarers of Catan 2000 3f3PmrkzV8 Catan Board Game - Gallery Edition 2008 l2i97dfuvD Star Trek: Catan 2012 E5TYKwLTf0 Catan: Cities and Knights Expansion 1998 lb4nZbOLOD Catan: Legend of the Sea Robbers Expansion NA qiJzLWCvPB Catan: Explorers and Pirates Expansion NA fz1hSbgUN2 A Game of Thrones Catan: Brotherhood of the Watch 2017

Before Starting

Every API call requires an client_id in the URL. In order to query BGA you will need to follow these steps to get a client_id and create an app:

  1. Log in or Sign up for a Board Game Atlas account.
  2. Create an app.
  3. Add client_id={your_client_id} to each of your requests.

See the “getting started” page at https://www.boardgameatlas.com/api/docs.

Once you have your client, the boardgameatlasR app requires you to save your client_id into your R environment as BOARDGAMEATLAS_PAT. You can edit this with Sys.setenv(BOARDGAMEATLAS_PAT = “YOUR_CLIENT_ID”) or through something like usethis::edit_r_environ()to save it to your environment. This way you reduce the risk exposure of your key.

Please note: this only covers the search of the BGA API, and more query features will hopefully be added in the future.

Acknowledgments

This code was built as part of Thomas Brambor’s Fall 2019 Modern Data Structures course in the Quantitative Methods of Social Science program at Columbia University, which covered many topics used in this project.

Additionally I’d like to acknowledge Colin Fay, who created a blogpost about building API wrappers (https://colinfay.me/build-api-wrapper-package-r/). Combining what I learned in my course with the basic steps and framework Colin described was invaluable for effectively moving through the process and building in some sensible components and tests.

Last, I would like to thank Trent Ellingsen of Board Game Atlas who was wonderfully helpful in describing the functionality of BGA and discussing future directions of the platform.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.



mdweisner/boardgameatlasR documentation built on July 10, 2020, 12:24 p.m.