Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/curso-r/scryr

An R package to access Scryfall's Magic: The Gathering API
https://github.com/curso-r/scryr

api mtg r

Last synced: about 2 months ago
JSON representation

An R package to access Scryfall's Magic: The Gathering API

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r, include = FALSE, message = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
library(dplyr)
library(tidyr)
glimpse <- purrr::partial(glimpse, width = 72)
```

# scryr

[![CRAN status](https://www.r-pkg.org/badges/version/scryr)](https://CRAN.R-project.org/package=scryr)
[![R-CMD-check](https://github.com/curso-r/scryr/workflows/R-CMD-check/badge.svg)](https://github.com/curso-r/scryr/actions)
[![Codecov test coverage](https://codecov.io/gh/curso-r/scryr/branch/main/graph/badge.svg)](https://app.codecov.io/gh/curso-r/scryr?branch=main)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5507/badge)](https://bestpractices.coreinfrastructure.org/projects/5507)

scryr is a simple, light, and robust interface between R and
[Scryfall](https://scryfall.com/)'s powerful _Magic: The Gathering_ card search
engine. It wraps the [Scryfall API](https://scryfall.com/docs/api) and makes all
endpoints available as simple functions that any R programmer can use.

## Installation

```r
# Install released version from CRAN
install.packages("scryr")
```

You can install the development version of scryr from
[GitHub](https://github.com/) with:

```r
# install.packages("devtools")
devtools::install_github("curso-r/scryr")
```

## Usage

scryr makes it easy to process _Magic_ cards' data programmatically. There are
many endpoints that fully support tidyverse compatible analyses. For more
information, start with `vignette("scryr")` or the [full
documentation](https://curso-r.github.io/scryr/).

```{r}
library(scryr)

# Find red creatures with 7 power, sorted by converted mana cost
cards <- scry_cards("c:red+pow=7", order = "cmc")

# Simple pipeline that counts how many cards of each rarity have a price
cards %>%
unnest(prices) %>%
filter(!is.na(usd)) %>%
count(rarity)

# Summary of full data
glimpse(cards)
```

## Code of Conduct

Please note that the scryr project is released with a [Contributor Code of
Conduct](https://curso-r.github.io/scryr/CODE_OF_CONDUCT.html). By contributing
to this project, you agree to abide by its terms.

## Copyright Notice

Portions of scryr are unofficial Fan Content permitted under the [Wizards of the
Coast Fan Content Policy](https://company.wizards.com/en/legal/fancontentpolicy).
The literal and graphical information presented on this package and its
documentation pages about _Magic: The Gathering_, including card images, the
mana symbols, and Oracle text, is copyright of Wizards of the Coast, LLC, a
subsidiary of Hasbro, Inc. This software is not produced by, endorsed by,
supported by, or affiliated with Wizards of the Coast, LLC.

Most of scryr's documentation is taken from Scryfall's developer docs and are
only included in the package for self-containedness' sake. Scryfall's website,
API, and other related content are copyright of Scryfall, LLC. This software is
not produced by, endorsed by, supported by, or affiliated with Scryfall, LLC.

As per [Scryfall's terms of service](https://scryfall.com/docs/terms), card data
and images are provided free of charge for the primary purpose of creating
additional _Magic_ software, performing research, or creating community content
about _Magic_ and related products. When using scryr, you must, therefore, adhere
to both Scryfall's and Wizards of the Coast's guidelines:

- You may not require anyone to make payments, take surveys, agree to
subscriptions, rate your content, or create accounts in exchange for access to
_Magic_ data.

- You may not use _Magic_ data to create new games, or to imply the information
and images are from any other game besides _Magic: The Gathering_.

- You may not claim any products or content made with _Magic_ data as official.
You must make it clear that your creation is not endorsed or sponsored by
Wizards and/or Scryfall, i.e., unofficial.