Skip to content
Prev 14907 / 29559 Next

extracting non-NA values from RasterLayer

Dear list, I am currently dealing with extremely large raster datasets
(100s of millions of cells), and am masking out large regions which
are of no particular interest for our current project. This produces
RasterLayers with a large number of NAs (but still millions of non-NA
cells as well). What I'd like to do is extract all non-NA values into
a vector for use in various statistical analyses, but I am having
trouble finding the most efficient means of doing so. Any pointers? I
have tried "sampleRandom", which is supposed to only take non-NA
cells, but there must be a better/faster way to extract *all* non-NA
values that I've just missed.

Cheers,

Carson