Analyze raster HI in R