Themeset {stoRy}R Documentation

R6 class representing an LTO themeset

Description

[Experimental]

The stoRy package uses the Themeset R6 class to represent user defined collections of themes. Themesets are currently in an experimental stage of development, but can be expected to become an integrate part of future stoRy package analysis functions.

Details

Various themesets are hosted on the themesets Theme Ontology GitHub repository https://github.com/theme-ontology/themesets.

Methods

Public methods


Method new()

Initialize a collection of LTO themes.

Usage
Themeset$new(file, verbose = TRUE)
Arguments
file

Either a file name, a path to a file, a url, or a single single must contain at least one newline to be recognized as such (as string as opposed to a path or url). Files must end with the standard .thset.txt extension used for themeset files.

If file is a file name, then the file is assumed to reside in the current working directory.

verbose

A logical value indicating whether status messages should be output to console.

Returns

A new Themeset object.


Method themeset_id()

return A length-one character vector corresponding to the themeset ID.

Usage
Themeset$themeset_id()

Method description()

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

Usage
Themeset$description()

Method component_theme_names()

return A tibble of member themes.

Usage
Themeset$component_theme_names()

Method size()

return A length-one numeric vector containing the number of themes in the themeset.

Usage
Themeset$size()

Method obj_internal_tbl()

a pre-computed table used internally by package functions

Usage
Themeset$obj_internal_tbl()

Method print()

Print collection object info to console.

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

Set to FALSE for pretty output.

n

Maximum number of component theme names to print to console. This defaults to NULL which means the getOption("stoRy.print_min") value is used. Run options(stoRy.print_min = 25L) to set the minimum number of printed component theme names to be 25. Run stoRy_opt("print_max") to check the maximum number of themes that can be printed to console. This value can be changed in the same way as with stoRy.print_min.

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
Themeset$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 Theme() to initialize an LTO theme.

Examples

## Not run: 
# Initialize a themeset from file:
set_lto("demo")
file <- system.file("extdata/immortality.thset.txt", package = "stoRy")
themeset <- Themeset$new(file)

# Print themeset info to console:
themeset

#' # Read themeset from a url and print to console:
set_lto("demo")
file <- paste0(
  "https://raw.githubusercontent.com/theme-ontology/",
  "master/demo/immortality.thset.txt"
)
themeset <- Themeset$new(file)
themeset

# Initialize a themeset directly from a string and print to console:
set_lto("demo")
file <- I("Themeset: immortality
=====================

:: Description
Themes related to people living on well beyond what is considered to be a
normal human lifespan.

:: Component Themes
immortality
the flip side of immortality
the quest for immortality")
themeset <- Themeset$new(file)
themeset 

## End(Not run)

[Package stoRy version 0.2.2 Index]