Themeset | R Documentation |
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.
Various themesets are hosted on the themesets Theme Ontology GitHub repository https://github.com/theme-ontology/themesets.
new()
Initialize a collection of LTO themes.
Themeset$new(file, verbose = TRUE)
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.
A new Themeset
object.
themeset_id()
return A length-one character vector corresponding to the themeset ID.
Themeset$themeset_id()
description()
return A length-one character vector corresponding to the themeset description.
Themeset$description()
component_theme_names()
return A tibble of member themes.
Themeset$component_theme_names()
size()
return A length-one numeric vector containing the number of themes in the themeset.
Themeset$size()
obj_internal_tbl()
a pre-computed table used internally by package functions
Themeset$obj_internal_tbl()
print()
Print collection object info to console.
Themeset$print(canonical = FALSE, n = NULL, width = NULL, ...)
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.
clone()
The objects of this class are cloneable with this method.
Themeset$clone(deep = FALSE)
deep
Whether to make a deep clone.
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.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.