View source: R/load_justifications.R
load_justifications | R Documentation |
These function load justifications from the YAML fragments
in one (load_justifications
) or multiple files (load_justifications_dir
).
load_justifications( text = NULL, file = NULL, delimiterRegEx = "^---$", justificationContainer = c("justifier", "justification", "decision", "assertion", "source"), ignoreOddDelimiters = FALSE, encoding = "UTF-8", storeDecisionGraphSvg = TRUE, silent = TRUE ) load_justifications_dir( path, recursive = TRUE, extension = "jmd", regex = NULL, justificationContainer = c("justifier", "justification", "decision", "assertion", "source"), delimiterRegEx = "^---$", ignoreOddDelimiters = FALSE, encoding = "UTF-8", silent = TRUE )
text, file |
As |
delimiterRegEx |
The regular expression used to locate YAML fragments |
justificationContainer |
The container of the justifications in the YAML fragments. Because only justifications are read that are stored in this container, the files can contain YAML fragments with other data, too, without interfering with the parsing of the justifications. |
ignoreOddDelimiters |
Whether to throw an error (FALSE) or delete the last delimiter (TRUE) if an odd number of delimiters is encountered. |
encoding |
The encoding to use when calling |
storeDecisionGraphSvg |
Whether to also produce (and return) the SVG for the decision graph. |
silent |
Whether to be silent (TRUE) or informative (FALSE). |
path |
The path containing the files to read. |
recursive |
Whether to also process subdirectories ( |
extension |
The extension of the files to read; files with other extensions will
be ignored. Multiple extensions can be separated by a pipe ( |
regex |
Instead of specifing an extension, it's also possible to specify a regular
expression; only files matching this regular expression are read. If specified, |
load_justifications_dir
simply identifies all files and then calls
load_justifications
for each of them. load_justifications
loads the
YAML fragments containing the justifications using
yum::load_yaml_fragments()
and then parses the justifications
into a visual representation as a
ggplot2::ggplot graph and Markdown documents with
overviews.
An object with the ggplot2::ggplot graph stored
in output$graph
and the overview in output$overview
.
exampleMinutes <- 'This is an example of minutes that include a source, an assertion, and a justification. For example, in the meeting, we can discuss the assertion that sleep deprivation affects decision making. We could quickly enter this assertion in a machine-readable way in this manner: --- assertion: - id: assertion_SD_decision label: Sleep deprivation affects the decision making proces. source: id: source_Harrison --- Because it is important to refer to sources, we cite a source as well. We have maybe specified that source elsewhere, for example in the minutes of our last meeting. That specification may have looked like this: --- source: - id: source_Harrison label: "Harrison & Horne (2000) The impact of sleep deprivation on decision making: A review." xdoi: "doi:10.1037/1076-898x.6.3.236" type: "Journal article" --- We can now refer to these two specifications later on, for example to justify decisions we take. '; justifier::load_justifications(text=exampleMinutes); ### To load a directory with justifications examplePath <- file.path(system.file(package="justifier"), 'extdata'); justifier::load_justifications_dir(path=examplePath);
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.