calculate_co_occurrences: Calculate code co-occurrences in annotations

View source: R/annotate_gui.R

calculate_co_occurrencesR Documentation

Calculate code co-occurrences in annotations

Description

Analyzes text annotations to identify and count instances where different codes overlap or co-occur in the same text regions. Handles edge cases and provides error-safe operation.

Usage

calculate_co_occurrences(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

Co-occurrences are identified by finding overlapping text regions between different code annotations. The function sorts annotations by position and checks for overlaps between each pair of annotations.

Value

Table object containing frequencies of code pairs that co-occur, with code pair names as "code1 & code2"


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