'Conditional mutate depending on if value is higher/lower than total

I have a table similar to this:

Area Value Lower Interval Upper Interval
AreaA 2 1.2 2.4
AreaB 11 10.7 11.6
AreaC 30 15.2 16.6
Total 12 11.2 12.5

I am looking to add a mutate column at the end called 'Significance' which has 3 conditions:

'Lower' if the upper interval for each area is below the lower interval for the total 'Same' if the confidence intervals between the areas and the grand total overlaps and 'Higher' if the lower interval for each area is below the upper interval for the total.

So in this instance the end result would look like this:

Area Value Lower Interval Upper Interval Significance
AreaA 2 1.2 2.4 Lower
AreaB 11 10.7 11.6 Same
AreaC 30 15.2 16.6 Higher
Total 12 11.2 12.5 -

Could anyone please advise on how to take this forward?

r


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source