-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathREADME.Rmd
146 lines (106 loc) · 6.85 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE, comment = "#>", fig.path = "man/figures/README-",
message = FALSE, warning = FALSE, error = FALSE
)
```
# rtrek <img src="man/figures/logo.png" style="margin-left:10px;margin-bottom:5px;" width="120" align="right">
<!-- badges: start -->
[![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)
<!-- badges: end -->
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.
<p style="text-align:center;"><img src="https://github.com/leonawicz/rtrek/blob/master/data-raw/images/rtrek_app1.png?raw=true" width="100%"></p>
*Image: Example [Leaflet map](https://leonawicz.github.io/rtrek/articles/sc.html) using non-geographic Star Trek map tiles.*
<br/>
## 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")
```
<h2 style="padding-bottom:0px;">Examples</h2><img src="https://github.com/leonawicz/rtrek/blob/master/data-raw/images/dixon_hill.jpg?raw=true" width=320 style="float: right; padding-left: 20px; padding-bottom:5px;">
<h4 style="padding-top:50px;padding-bottom:0px;">Time to be good detectives. Good thing Data has R installed.</h4>
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
<div class="row">
<div class="col-sm-2">
<a href="https://github.com/leonawicz/rtrek"><img src="https://raw.githubusercontent.com/leonawicz/rtrek/master/man/figures/logo.png" style="margin-right:20px;margin-bottom:0;" width="120" align="left"></a>
</div>
<div class="col-sm-10">
<h4 style="padding:30px 0 0 0;margin-top:5px;margin-bottom:5px;"><a href="https://github.com/leonawicz/rtrek">rtrek</a>: The core Star Trek package</h4>
Datasets related to Star Trek, API wrappers to external data sources, and more.
</div></div>
<br/>
<div class="row">
<div class="col-sm-2">
<a href="https://github.com/leonawicz/lcars"><img src="https://raw.githubusercontent.com/leonawicz/lcars/master/man/figures/logo.png" style="margin-right:20px;margin-bottom:0;" width="120" align="left"></a>
</div>
<div class="col-sm-10">
<h4 style="padding:30px 0 0 0;margin-top:5px;margin-bottom:5px;"><a href="https://github.com/leonawicz/lcars">lcars</a>: LCARS aesthetic for Shiny</h4>
Create Shiny apps based on the Library Computer Access/Retrieval System (LCARS).
</div></div>
<br/>
<div class="row">
<div class="col-sm-2">
<a href="https://github.com/leonawicz/trekcolors"><img src="https://raw.githubusercontent.com/leonawicz/trekcolors/master/man/figures/logo.png" style="margin-right:20px;margin-bottom:0;" width="120" align="left"></a>
</div>
<div class="col-sm-10">
<h4 style="padding:30px 0 0 0;margin-top:5px;margin-bottom:5px;"><a href="https://github.com/leonawicz/trekcolors">trekcolors</a>: A color palette package</h4>
Predefined and customizable Star Trek themed color palettes and related functions.
</div></div>
<br/>
<div class="row">
<div class="col-sm-2">
<a href="https://github.com/leonawicz/trekfont"><img src="https://raw.githubusercontent.com/leonawicz/trekfont/master/man/figures/logo.png" style="margin-right:20px;margin-bottom:0;" width="120" align="left"></a>
</div>
<div class="col-sm-10">
<h4 style="padding:30px 0 0 0;margin-top:5px;margin-bottom:5px;"><a href="https://github.com/leonawicz/trekfont">trekfont</a>: A fonts package</h4>
True (Trek) type fonts to style your Star Trek themed graphics text.
</div></div>
<br>
## Citation
Matthew Leonawicz (`r substr(Sys.Date(), 1, 4)`). rtrek: Data analysis relating to Star Trek. R package version 0.5.1. 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.