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

https://github.com/leonawicz/rtrek

R package for Star Trek datasets and related R functions.
https://github.com/leonawicz/rtrek

data r-package stapi star-trek

Last synced: 5 months ago
JSON representation

R package for Star Trek datasets and related R functions.

Awesome Lists containing this project

README

          

---
output: github_document
---

```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE, comment = "#>", fig.path = "man/figures/README-",
message = FALSE, warning = FALSE, error = FALSE
)
```

# rtrek

[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/)
[![R-CMD-check](https://github.com/leonawicz/rtrek/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/leonawicz/rtrek/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/leonawicz/rtrek/graph/badge.svg)](https://app.codecov.io/gh/leonawicz/rtrek)
[![CRAN status](https://www.r-pkg.org/badges/version/rtrek)](https://CRAN.R-project.org/package=rtrek)
[![CRAN downloads](https://cranlogs.r-pkg.org/badges/grand-total/rtrek)](https://cran.r-project.org/package=rtrek)
[![Github Stars](https://img.shields.io/github/stars/leonawicz/rtrek.svg?style=social&label=Github)](https://github.com/leonawicz/rtrek)

The `rtrek` package provides datasets related to the Star Trek fictional universe and functions for working with those datasets. It interfaces with the [Star Trek API](http://stapi.co/) (STAPI), [Memory Alpha](https://memory-alpha.fandom.com/wiki/Portal:Main) and [Memory Beta](https://memory-beta.fandom.com/wiki/Main_Page) to retrieve data, metadata and other information relating to Star Trek.

The package also contains several local datasets covering a variety of topics such as Star Trek timeline data, universe species data and geopolitical data. Some of these are more information rich, while others are toy examples useful for simple demonstrations. The bulk of Star Trek data is accessed from external sources by API. A future version of `rtrek` will also include summary datasets resulting from text mining analyses of Star Trek novels.

*Image: Example [Leaflet map](https://leonawicz.github.io/rtrek/articles/sc.html) using non-geographic Star Trek map tiles.*


## Installation

Install the CRAN release of `rtrek` with

``` r
install.packages("rtrek")
```

Install the development version from GitHub with

``` r
# install.packages("remotes")
remotes::install_github("leonawicz/rtrek")
```

Examples

Time to be good detectives. Good thing Data has R installed.

These are just a few examples to help you jump right in. See the package articles for more.

### STAPI

Use the Star Trek API (STAPI) to obtain information on the infamous character, Q. Specifically, retrieve data on his appearances and the stardates when he shows up.

The first API call does a lightweight, unobtrusive check to see how many pages of potential search results exist for characters in the database. There are a lot of characters.

The second call grabs only page two results. The third call uses the universal/unique ID `uid` to retrieve data on Q. Think of these three successive uses of `stapi()` as safe mode, search mode and extraction mode.

```{r ex, thm = knitr::knit_theme$get("molokai")}
library(rtrek)
library(dplyr)
stapi("character", page_count = TRUE)

stapi("character", page = 1) |> select(uid, name)

Q <- "CHMA0000025118" #unique ID
Q <- stapi("character", uid = Q)
Q$episodes |> select(uid, title, stardateFrom, stardateTo)
```

### Memory Alpha

Obtain content and metadata from the article about Spock on Memory Alpha:

```{r spock}
x <- ma_article("Spock")
x
x$metadata[[1]]$Born
```

### Memory Beta

Spock was born in 2230. Obtain a subset of the Star Trek universe historical timeline for that year:

```{r timeline}
mb_timeline(2230)
```

Live long and prosper.

## Packages in the trekverse







rtrek: The core Star Trek package


Datasets related to Star Trek, API wrappers to external data sources, and more.










lcars: LCARS aesthetic for Shiny


Create Shiny apps based on the Library Computer Access/Retrieval System (LCARS).










trekcolors: A color palette package


Predefined and customizable Star Trek themed color palettes and related functions.










trekfont: A fonts package


True (Trek) type fonts to style your Star Trek themed graphics text.


## Citation

Matthew Leonawicz (`r substr(Sys.Date(), 1, 4)`). rtrek: Data analysis relating to Star Trek. R package version 0.5.2. https://CRAN.R-project.org/package=rtrek

## Contribute

Contributions are welcome. Contribute through GitHub via pull request. Please create an issue first if it is regarding any substantive feature add or change.

---

Please note that the `rtrek` project is released with a [Contributor Code of Conduct](https://github.com/leonawicz/rtrek/blob/master/CODE_OF_CONDUCT.md). By contributing to this project, you agree to abide by its terms.