load_dct_dir {psyverse} | R Documentation |
Load DCT specifications from a file or multiple files
Description
These function load DCT specifications from the YAML fragments
in one (load_dct_specs
) or multiple files (load_dct_dir
).
Usage
load_dct_dir(
path,
recursive = TRUE,
extension = "\\.rock|\\.dct\\.yaml|\\.yaml|\\.yml",
regex,
dctContainer = "dct",
headingLevel = 2,
delimiterRegEx = "^---$",
ignoreOddDelimiters = FALSE,
encoding = "UTF-8",
sortDecreasing = FALSE,
silent = TRUE
)
load_dct_specs(
text,
file,
delimiterRegEx = "^---$",
dctContainer = "dct",
headingLevel = 2,
ignoreOddDelimiters = FALSE,
encoding = "UTF-8",
silent = TRUE
)
## S3 method for class 'dct_specs'
print(x, ...)
## S3 method for class 'dct_specs'
plot(x, ...)
Arguments
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, |
dctContainer |
The container of the DCT specifications in the YAML fragments. Because only DCT specifications 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 DCT specifications. |
headingLevel |
The level of the Markdown headings that are produced. |
delimiterRegEx |
The regular expression used to locate YAML fragments |
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 |
sortDecreasing |
Whether to sort the constructs in decreasing order
( |
silent |
Whether to be silent (TRUE) or informative (FALSE). |
text , file |
As |
x |
The parsed |
... |
Any other arguments are passed to the print command. |
Details
load_dct_dir
simply identifies all files and then calls
load_dct_specs
for each of them. load_dct_specs
loads the
YAML fragments containing the DCT specifications using
yum::load_yaml_fragments()
and then parses the DCT
specifications into a visual representation as a
DiagrammeR::DiagrammeR graph and Markdown documents with
the instructions for creating measurement instruments or
manipulations, and for coding measurement instruments,
manipulations, or aspects of a construct.
Value
An object with the DiagrammeR::DiagrammeR graph stored
in output$basic_graph
, a DiagrammeR::DiagrammeR graph with a summary
of which specifications are provided for each construct in
output$completeness_graph
and the instructions in output$instr
.
Examples
exampleSpec <-
system.file("extdata",
"example.dct.yaml",
package="psyverse");
dctObject <- load_dct_specs(exampleSpec);
## Not run:
psyverse::load_dct_dir(path="A:/some/path");
## End(Not run)