calculate_transitions: Calculate transitions between consecutive codes

View source: R/annotate_gui.R

calculate_transitionsR Documentation

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)

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.

Value

List where each element is a named vector containing:

  • from: Character string of the source code

  • to: Character string of the target code


textAnnotatoR documentation built on April 3, 2025, 7:35 p.m.