Access curated data frames containing Star Trek timeline data.

mb_timeline(x, html = FALSE)

Arguments

x

numeric or character, description of the desired timeline window. See details.

html

logical, set to TRUE to return the details text column of the Events data frame as basic HTML character strings.

Value

a list of two data frames

Details

The timeline data is from the Memory Beta Chronology.

x can be a numeric vector of years, e.g. x = 2361:2364. This should only be used if you know (or can safely assume) a year exists as a page on Memory Beta. Check there first if unsure. x may otherwise be scalar character. This can be a specific decade in the form, e.g., "2370s". If a decade, it must fall in the range from "1900s" through "2490s". The decade option pulls back data from the decade page entry, or if individual year pages exist within the given decade, it will pull the data for each existing year.

Special values: For the more distant past or future, use the character options x = "past" or x = "future". x = "main" will pull from the main part of the timeline, 1900 - 2499. x = "complete" combines past, main, and future in order.

The distant past and future have few entries, and thus few pages. However, both of these last two options, "main" and complete, must download a large number of pages. For this reason, rtrek employs anti-DOS measures to prevent an unwitting user from making too many requests too quickly from Memory Beta. The function would otherwise be far faster. However, to be a friendly neighbor in the cosmos, rtrek enforces a minimum one-second wait between timeline requests. This can lead to downloading the full timeline to take ten minutes or so even if you have a fast connection; most of the time it takes is spent waiting patiently.

Also, like other functions that work with Memory Alpha and Memory Beta data, mb_timeline() wraps around internal functions that are sensibly memoized. This means that if you make the same call twice in your R session, you won't have to wait at all, because the result is cached in memory. The call will appear to run instantaneously the second time around, but that's because nothing is happening other than returning the cached result from the initial call.

Examples

mb_timeline(2360)
#> 2360 
#> $events
#> # A tibble: 21 × 2
#>    period details                                                               
#>    <chr>  <chr>                                                                 
#>  1 2360   Events                                                                
#>  2 2360   Quark opens a bar on Terok Nor.                                       
#>  3 2360   Politics                                                              
#>  4 2360   Conflicts                                                             
#>  5 2360   Kalisi Reyar designs and completes a grid system that watches out for…
#>  6 2360   Federation politics                                                   
#>  7 2360   Pahkwa-thanh is admitted into the Federation. [citation needed]       
#>  8 2360   Cardassian politics                                                   
#>  9 2360   Miras Vara has taken the leadership of the Oralian Way as Astraea; in…
#> 10 2360   Natima Lang and Gaten Russol join the cardassian dissident movement   
#> # ℹ 11 more rows
#> 
#> $stories
#> # A tibble: 7 × 11
#>   title   title_url colleciton collection_url section context series date  media
#>   <chr>   <chr>     <chr>      <chr>          <chr>   <chr>   <chr>  <chr> <chr>
#> 1 The Bu… The_Buri… NA         NA             Chapte… NA      The N… 2360  novel
#> 2 Fearfu… Fearful_… NA         NA             Side 2… NA      Deep … 2360  novel
#> 3 The Bu… The_Buri… NA         NA             Chapte… NA      The N… 2360… novel
#> 4 Cataly… Catalyst… NA         NA             NA      NA      The L… 2360  novel
#> 5 Lefler… Lefler%2… No Limits  No_Limits      Twelft… NA      New F… 2360… shor…
#> 6 A Stit… A_Stitch… NA         NA             Part 2… NA      Deep … 2360  novel
#> 7 Dawn o… Dawn_of_… Terok Nor  Star_Trek:_Te… Prolog… NA      Deep … 2360  novel
#> # ℹ 2 more variables: notes <chr>, image_url <chr>
#> 
if (FALSE) { # \dontrun{
mb_timeline("2360s")
mb_timeline("past")
mb_timeline("future")
mb_timeline("main")
mb_timeline("complete")
mb_timeline("complete", html = TRUE)
} # }