When conducting cognitive interviews, it can be useful to quickly inspect the code distributions for each item. These heatmaps facilitate that process.
ci_heatmap(
x,
nrmSpec = NULL,
language = nrmSpec$defaultLanguage,
wrapLabels = 80,
itemOrder = NULL,
itemLabels = NULL,
itemIdentifier = "uiid",
codingScheme = "peterson",
itemlab = NULL,
codelab = NULL,
freqlab = "Count",
plotTitle = "Cognitive Interview Heatmap",
fillScale = ggplot2::scale_fill_viridis_c(),
theme = ggplot2::theme_minimal()
)
The object with the parsed coded source(s) as resulting from a
call to parse_source()
or parse_sources()
.
Optionally, an imported Narrative Response Model
specification, as imported with ci_import_nrm_spec()
, which will
then be used to obtain the item labels.
If nrmSpec
is specified, the language to use.
Whether to wrap the labels; if not NULL
, the
number of character to wrap at.
Instead of specifying an NRM specification,
you can also directly specify the item order and item labels. itemOrder
is a character vector of item identifiers, and itemLabels
is a named
character vector of item labels, where each value's name is the
corresponding item identifier. If itemLabels
is provided but itemOrder
is not, the order of the itemLabel
is used.
The column identifying the items; the class instance
identifier prefix, e.g. if item identifiers are specified as
[[uiid:familySize_7djdy62d]]
, the itemIdentifier
to pass here
is "uiid"
.
The coding scheme, either as a string if it represents
one of the cognitive interviewig coding schemes provided with the rock
package, or as a coding scheme resulting from a call
to create_codingScheme()
.
Labels to use for the item and code axes
and for the frequency color legend (NULL
to omit the label).
The title to use for the plot
Convenient way to specify the fill scale (the colours)
Convenient way to specify the ggplot2::ggplot()
theme.
The heatmap as a ggplot2 plot.
examplePath <- file.path(system.file(package="rock"), 'extdata');
parsedCI <- rock::parse_source(
file.path(examplePath,
"ci_example_1.rock")
);
rock::ci_heatmap(parsedCI,
codingScheme = "peterson");