Learn R Programming

stoRy (version 0.1.0)

story: Story objects

Description

The stoRy package uses the story object to store story themes and other meta-data.

Usage

story

Arguments

story

The object is typically created by passing a story ID from any of the Star Trek TOS/TAS/TNG series to construct the object automatically from system data. A user-defined story IDs may alos be accepted in which case the fields will be empty, if not supplied by the user.

Format

An object of class R6ClassGenerator of length 24.

Fields

Each story object has the following ten fields

story_id

A story ID. See examples.

title

A string giving the story title.

writer

A string giving the story writer.

director

A string giving the story director.

original_air_date

A string giving the story original air date in the forr YYYY-MM-DD

summary

A string giving a summary of the story.

characters

A list of story characters. The list has three fields: ObjectCharacters, MajorCharacters, and MinorCharacters. Each list entry should be a ", " separated string of character names.

themes

A data frame of story themes with associated meta-data.

settings

A data frame of story settings with associated meta-data.

keywords

A data frame of story keywords with associated meta-data.

Examples

Run this code
# NOT RUN {
########################################################################
# Create a story object for the Star Trek The Original Series episode  #
# TOS1x19 "The Arena" and manipulate it in various ways                #
########################################################################
story_id <- "TOS1x19"
mystory <- story$new(story_id)
print(mystory)
# Add "pride" as a minor theme
mystory$add_theme(theme = "pride", level = "minor")
# Remove "pride" as a minor theme on second thought
mystory$remove_theme(theme = "pride")
# Add "candy shop" as a setting
mystory$add_setting(setting = "candy shop")
# Remove "candy shop" as a setting
#' mystory$remove_setting(setting = "candy shop")
# Add a new keyword
mystory$add_keyword(keyword = "Captain Kirk is climbing a mountain")
# }

Run the code above in your browser using DataLab