mb_timeline: Memory Beta timeline

View source: R/mb_timeline.R

mb_timelineR Documentation

Memory Beta timeline

Description

Access curated data frames containing Star Trek timeline data.

Usage

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.

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.

Value

a list of two data frames

Examples

mb_timeline(2360)
## Not run: 
mb_timeline("2360s")
mb_timeline("past")
mb_timeline("future")
mb_timeline("main")
mb_timeline("complete")
mb_timeline("complete", html = TRUE)

## End(Not run)

leonawicz/rtrek documentation built on Sept. 18, 2024, 7:21 a.m.