Learn R Programming

textAnnotatoR (version 1.0.1)

calculate_transitions: Calculate transitions between consecutive codes

Description

Analyzes the sequence of code applications to identify transitions between consecutive codes in the text. Creates a list of code pairs representing each transition from one code to another.

Usage

calculate_transitions(annotations)

Value

List where each element is a named vector containing:

  • from: Character string of the source code

  • to: Character string of the target code

Arguments

annotations

Data frame containing annotations with columns:

  • start: numeric, starting position of annotation

  • end: numeric, ending position of annotation

  • code: character, code identifier

Details

Transitions are identified by sorting annotations by position and then analyzing consecutive pairs of codes. The function handles edge cases and provides error-safe operation.