I am working with a raster and want to take values assigned to each cell and sort them from largest to smallest, then cummulatively sum them together (in order from largest to smallest). I'll then be coding the individual cells such that the top 10% of the largest cell values can be visualize with one color, the next 10% with another and so on.

I have tried a number of schemes but am having trouble figuring out how to chose the maximum value, code it and re-search the raster for the next highest value without replacement. I am assuming this requires a loop, unless there is a function that will do this automatically.

Here is a sample dataset:

library(raster)
r <- raster(ncol=10, nrow=10)
values(r) <- runif(ncell(r))

Many thanks for any input,
Sara Maxwell
---------------------------------------------------
Sara M. Maxwell, Ph.D.
UC Santa Cruz

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to