Find index for compound range in target string
find_level_idx.RdFind the index of a compound range (e.g., "0_4", "2_plus") in a numeric levels vector. Use to map string categories to numeric indices for tabulation and reporting.
Details
Returns last index for "_plus" categories.
For ranges, returns index of highest numeric value in string.
Falls back to direct match or NA if not found.
Assumes sorted levels and valid labels.
See also
get_target_mapscripts/reporting/find_level_idx.R
Other reporting utilities:
get_target_map(),
summarize_data(),
summarize_pums(),
summarize_survey(),
tabulate_target()