The rock::opts
object contains three functions to set, get, and reset
options used by the rock package. Use rock::opts$set
to set options,
rock::opts$get
to get options, or rock::opts$reset
to reset specific or
all options to their default values.
opts
An object of class list
of length 4.
It is normally not necessary to get or set rock
options. The defaults implement
the Reproducible Open Coding Kit (ROCK) standard, and deviating from these defaults
therefore means the processed sources and codes are not compatible and cannot be
processed by other software that implements the ROCK. Still, in some cases this
degree of customization might be desirable.
The following arguments can be passed:
For rock::opts$set
, the dots can be used to specify the options
to set, in the format option = value
, for example, utteranceMarker = "\n"
. For
rock::opts$reset
, a list of options to be reset can be passed.
For rock::opts$set
, the name of the option to set.
For rock::opts$get
, the default value to return if the
option has not been manually specified.
Some of the options that can be set (see rock::opts$defaults
for the
full list):
A named character vector with one or more regular expressions that specify how to extract the codes (that were used to code the sources). These regular expressions must each contain one capturing group to capture the codes.
A named character vector with one or more regular expressions that specify how to extract the different types of identifiers. These regular expressions must each contain one capturing group to capture the identifiers.
A named character vector with one or more regular expressions that specify how to extract the different types of sections.
The names of the idRegexes
that, if missing, should receive
autogenerated identifiers (which consist of 'autogenerated_' followed by an
incrementing number).
This regular expression is matched with all codes after they have been
extracted using the codeRegexes
regular expression (i.e. they're matched against the
codes themselves without, for example, the square brackets in the default code regex). Any
codes matching this noCodes
regular expression will be ignored, i.e., removed from the
list of codes.
For inductive coding, this marker is used to indicate
hierarchical relationships between codes. The code at the left hand side of this marker will
be considered the parent code of the code on the right hand side. More than two levels
can be specified in one code (for example, if the inductiveCodingHierarchyMarker
is '>',
the code grandparent>child>grandchild
would indicate codes at three levels.
The name of YAML fragments containing case attributes (e.g. metadata, demographic variables, quantitative data about cases, etc).
The name of YAML fragments containing (parts of) deductive coding trees.
The regular expression that is used to extract the YAML fragments.
A character vector of two elements specifying the opening and closing delimiters of codes (conform the default ROCK convention, two square brackets). The square brackets will be escaped; other characters will not, but will be used as-is.
The regular expression that is used to delete lines before any other processing. This can be used to enable adding comments to sources, which are then ignored during analysis.
Whether to include the default bootstrap CSS.
How to specify breaks between utterances in the source(s). The
ROCK convention is to use a newline (\\n
).
A regular expression specifying the coder identifier, specified similarly to the codeRegexes.
The identifier to use for utterances that do not have a coder id (i.e. utterance that occur in a source that does not specify a coder id, or above the line where a coder id is specified).
### Get the default utteranceMarker
rock::opts$get(utteranceMarker);
### Set it to a custom version, so that every line starts with a pipe
rock::opts$set(utteranceMarker = "\n|");
### Check that it worked
rock::opts$get(utteranceMarker);
### Reset this option to its default value
rock::opts$reset(utteranceMarker);
### Check that the reset worked, too
rock::opts$get(utteranceMarker);
Run the code above in your browser using DataLab