create_cooccurrence_matrix {rock} | R Documentation |
Create a co-occurrence matrix
Description
This function creates a co-occurrence matrix based on one or more
coded sources. Optionally, it plots a heatmap, simply by calling
the stats::heatmap()
function on that matrix.
Usage
create_cooccurrence_matrix(
x,
codes = x$convenience$codingLeaves,
plotHeatmap = FALSE
)
Arguments
x |
The parsed source(s) as provided by |
codes |
The codes to include; by default, takes all codes. |
plotHeatmap |
Whether to plot the heatmap. |
Value
The co-occurrence matrix; a matrix
.
Examples
### Get path to example source
examplePath <-
system.file("extdata", package="rock");
### Parse a selection of example sources in that directory
parsedExamples <-
rock::parse_sources(
examplePath,
regex = "(test|example)(.txt|.rock)"
);
### Create cooccurrence matrix
rock::create_cooccurrence_matrix(parsedExamples);
[Package rock version 0.8.1 Index]