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. CRAN status CRAN downloads Github Stars

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 (STAPI), Memory Alpha and Memory Beta 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 using non-geographic Star Trek map tiles.


Installation

Install the CRAN release of rtrek with

install.packages("rtrek")

Install the development version from GitHub with

# 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.

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:

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:

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.4.0. 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. By contributing to this project, you agree to abide by its terms.



leonawicz/rtrek documentation built on Sept. 18, 2023, 11:29 p.m.