【R】rtrek
2020年11月29日
1. はじめに
rtrek
はスタートレックのデータを簡単に扱えるパッケージです。
2. インストール
CRANからインストールできます。
install.packages("rtrek")
3. 使ってみる
library(rtrek) library(dplyr) stapi("character", page_count = TRUE)
> stapi("character", page_count = TRUE)
Total pages to retrieve all results: 66
stapi("character", page = 5) %>% select(uid, name)
> stapi("character", page = 5) %>% select(uid, name)
# A tibble: 100 x 2
uid name
<chr> <chr>
1 CHMA0000194445 Trevor Roth
2 CHMA0000068408 Aphrodite
3 CHMA0000025932 Marauder Mo
4 CHMA0000078153 Jake Tapper
5 CHMA0000043015 Brent Spiner Raymond
6 CHMA0000030205 Zepht
7 CHMA0000080487 Avik
8 CHMA0000226504 O. Osunsanmi
9 CHMA0000023000 Alzen
10 CHMA0000009529 Wixiban
# ... with 90 more rows
Q <- "CHMA0000021696" Q <- stapi("character", uid = Q) Q$episodes %>% select(uid, title, stardateFrom, stardateTo)
> Q$episodes %>% select(uid, title, stardateFrom, stardateTo)
uid title stardateFrom stardateTo
1 EPMA0000000958 Empok Nor 50901.7 50901.7
mb_timeline(2228)
> mb_timeline(2228)
2228
$events
# A tibble: 2 x 4
period id date notes
<chr> <chr> <chr> <chr>
1 2228 Events NA Greshlahrigm of Tellar is elected as the fourteenth President of t~
2 2228 Events NA Nine-year-old Christopher Pike moves from Earth to the new colony ~
$stories
# A tibble: 1 x 11
title title_url colleciton collection_url section context series date media notes
<chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
1 Burn~ Burning_~ NA NA Chapte~ NA The O~ 2228 novel NA
# ... with 1 more variable: image_url <chr>
3. さいごに
スタートレックのデータをいろいろ使えそうです。