parse_justifications {justifier} | R Documentation |
Parsing justifications
Description
This function is normally called by load_justifications()
; however,
sometimes it may be desirable to parse justifications embedded in more
complex objects, for example as provided by yum::load_and_simplify()
.
Therefore, this function can also be called directly.
Usage
parse_justifications(
x,
justifierFields = "^date$|^framework$",
fromFile = NULL,
path = NULL,
storeDecisionGraphSvg = FALSE,
silent = TRUE
)
## S3 method for class 'justifierDecisionGraph'
print(x, ...)
## S3 method for class 'justifierDecisionGraph'
plot(x, ...)
Arguments
x |
An object resulting from a call to |
justifierFields |
Which fields to copy from |
fromFile |
The file from which the |
path |
The path holding these |
storeDecisionGraphSvg |
Whether to also produce (and return) the SVG for the decision graph. |
silent |
Whether to be chatty or quiet. |
... |
Additional arguments are passed on to |
Details
While there is some flexibility in how justifications can be specified, they are most easily processed further if they all follow the same conventions. This function ensures this. The convention is as follows:
all specifications are provided in four 'flat' lists, named after the types of elements they contain;
all elements have a unique identifier
all references to other elements are indeed only references to the other elements' id's in these 'flat lists'
Value
The parsed justifier
object.
Examples
### Specify an example text
exampleFile <-
system.file("extdata",
"simple-example.jmd",
package="justifier");
### Show contents
cat(readLines(exampleFile), sep="\n");
### Load it with yum::load_and_simplify()
loadedMinutes <- yum::load_and_simplify(exampleFile);
### Show contents
names(loadedMinutes);
### Parse 'manually'
parsedJustifications <- justifier::parse_justifications(loadedMinutes);
### Show contents
names(parsedJustifications);