title: Raster: How to remove top-valued cells such that mean value is reduced by X%?
body: <p>Say I have a RasterLayer with a mean value of X.</p>
  <p>How would I go about iteratively removing the highest-value cells such that I reduce the mean value by some percentage?</p>
  <p>The background of my question is I have a spatial layer with cell values that represent relative 'risk'. I want to determine how much is the least area to 'close' (i.e. how many and which of the highest cells to remove) such that overall 'risk' is reduced by 10%, 20%, 50%, etc. I am fiddling with some basic raster operations but I was wondering if anyone had done something similar before and how.</p>
  <p>Thank you!</p>