
Gather big segments and assign levels iteratively
AssignLevels.Rd
Iterates through the given segments_copy data frame. Does the following at each iteration:
Finds the largest segment (by size). Then, finds all the segments 'close' to it: closeness here means that that ratio_median difference between them is less than threshold (
thr
).Once we identify these segments that are 'close' to each other (called closest_indices), we iterate through them, and set their level in
segments
.Finally, remove these closest_indices segments from
segments_copy
.