parsed_sources_to_ena_network {rock}R Documentation

Create an ENA network out of one or more parsed sources

Description

Create an ENA network out of one or more parsed sources

Usage

parsed_sources_to_ena_network(
  x,
  unitCols,
  conversationCols = "originalSource",
  codes = x$convenience$codingLeaves,
  metadata = x$convenience$attributesVars
)

Arguments

x

The parsed source(s) as provided by rock::parse_source or rock::parse_sources.

unitCols

The columns that together define units (e.g. utterances in each source that belong together, for example because they're about the same topic).

conversationCols

The columns that together define conversations (e.g. separate sources, but can be something else, as well).

codes

The codes to include; by default, takes all codes.

metadata

The columns in the merged source dataframe that contain the metadata. By default, takes all read metadata.

Value

The result of a call to rENA::ena.plot.network(), if that is installed.

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)"
  );

### Add something to indicate which units belong together; normally,
### these would probably be indicated using one of the identifier,
### for example the stanza identifiers, the sid's
nChunks <- nrow(parsedExamples$mergedSourceDf) %/% 10;
parsedExamples$mergedSourceDf$units <-
  c(rep(1:nChunks, each=10), rep(max(nChunks), nrow(parsedExamples$mergedSourceDf) - (10*nChunks)));

### Generate ENA plot

enaPlot <-
  rock::parsed_sources_to_ena_network(parsedExamples,
                                      unitCols='units');

### Show the resulting plot
print(enaPlot);



[Package rock version 0.8.1 Index]