Learn R Programming

textAnnotatoR (version 1.0.1)

calculate_hierarchy_stats: Calculate hierarchy statistics

Description

Calculates various statistics about the code hierarchy including the total number of themes and codes, maximum depth, and distribution of codes across themes. Now also accounts for codes not associated with any theme.

Usage

calculate_hierarchy_stats(node, all_codes = NULL)

Value

A list containing hierarchy statistics:

  • total_themes: Total number of themes in the hierarchy (excluding root)

  • total_codes: Total number of codes in the hierarchy

  • unassigned_codes: Number of codes not in the hierarchy

  • max_depth: Maximum depth of the hierarchy tree

  • codes_per_theme: List showing number of codes in each theme

  • average_codes_per_theme: Average number of codes per theme

Arguments

node

Root node of the hierarchy tree

all_codes

Character vector of all codes in the application