Skip to content
Prev 24019 / 29559 Next

Calculate percent cover in a raster

Hi,

I think you can use raster::reclassify() or raster::cut() to bin your rainfall.

intervals <- seq(from = 0, to = 600, by = 100)
ix <- cut(r, breaks = intervals)
tx <- table(as.vector(ix))
tx

  1   2   3   4   5   6 
 46  64  85  76 100  69 

tx/sum(tx)*100

       1        2        3        4        5        6 
10.45455 14.54545 19.31818 17.27273 22.72727 15.68182 

Is that what you are looking for?


Cheers,
Ben
Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org