Theme: R6 class representing an LTO literary theme

ThemeR Documentation

R6 class representing an LTO literary theme

Description

[Maturing]

The stoRy package uses the Theme R6 class to represent individual LTO literary themes. This class is mostly useful for accessing information about an LTO theme for which the theme name is known in advance.

Details

The class operates on the themes of whichever LTO version happens to be actively loaded into the stoRy package level environment. This is the LTO demo version by default. Run which_lto() to check which LTO version is active in your R session.

Search the latest LTO dev version themes on the Theme Ontology website at https://www.themeontology.org/themes.

Methods

Public methods


Method new()

Initialize an LTO theme.

Usage
Theme$new(theme_name)
Arguments
theme_name

A length-one character vector corresponding to an LTO theme name.

Returns

A new Theme object.


Method theme_name()

return A length-one character vector corresponding to the theme name.

Usage
Theme$theme_name()

Method aliases()

return A tibble of theme name aliases.

Usage
Theme$aliases()

Method description()

return A length-one character vector corresponding to the theme description.

Usage
Theme$description()

Method notes()

return A tibble of caveats that accompany that theme description. This is empty for the vast majority of themes.

Usage
Theme$notes()

Method references()

return A tibble of references.

Usage
Theme$references()

Method examples()

return A tibble of example usages of the theme, if any.

Usage
Theme$examples()

Method parents()

return A tibble of the theme's parent theme names.

Usage
Theme$parents()

Method ancestors()

return A tibble of the theme's ancestor theme names.

Usage
Theme$ancestors()

Method source()

return The path of the th.txt file containing the theme. This is the file path as it occurs on the Theme Ontology GitHub repository at https://github.com/theme-ontology/theming.

Usage
Theme$source()

Method annotations()

return A tibble with one row for each story in which the theme is featured. The first column is the LTO story ID, the second is the release data, the third is the level (choice/major/minor) at which the theme is featured, and the fourth a justification for applying the theme. Each column is of type character.

Usage
Theme$annotations()

Method print()

Print theme object info to console.

Usage
Theme$print(canonical = FALSE, width = NULL, ...)
Arguments
canonical

Set to FALSE for pretty output.

width

Width of text output to generate. This defaults to NULL, which means the stoRy_opt("width") value is used. Run options(stoRy.width = 120L) to change the column width to be 120 characters, etc.

...

Additional arguments.


Method clone()

The objects of this class are cloneable with this method.

Usage
Theme$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Use Collection() to initialize an collection of LTO thematically annotated stories.

Use Story() to initialize an LTO thematically annotated story.

Use Themeset() to initialize a set of related LTO themes.

Examples

## Not run: 
# Initialize an LTO `demo` version theme pertaining to Martians:
set_lto("demo")
theme <- Theme$new(theme_name = "Martian extraterrestrial")

# Print theme info to console:
theme

# Print theme info to console in the canonical th.txt format:
theme$print(canonical = TRUE)

# Return the theme description:
theme$description()

# Return references associated with the description, if any:
theme$references()

# Return theme name aliases, if any:
theme$aliases()

# Return the theme's parent theme names:
theme$parents()

# Return the theme's ancestor theme names:
theme$ancestors()

# Return a tibble of thematically annotated stories:
theme$annotations()

## End(Not run)

stoRy documentation built on July 9, 2023, 7:46 p.m.