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.
calculate_transitions(annotations)List where each element is a named vector containing:
from: Character string of the source code
to: Character string of the target code
Data frame containing annotations with columns:
start: numeric, starting position of annotation
end: numeric, ending position of annotation
code: character, code identifier
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.