knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of boardgameatlasR is to provide a basic API wrapper for querying the Board Game Atlas (BGA) search API, found at https://api.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://api.boardgameatlas.com/api/docs.
You can install the development version from GitHub with:
# install.packages("devtools") devtools::install_github("mdweisner/boardgameatlasr")
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")
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:
See the "getting started" page at https://api.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.
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.