[R-sig-Geo] extracting non-NA values from RasterLayer

Rafael Wüest rafael.wueest at wsl.ch
Wed Apr 25 12:45:35 CEST 2012


Hi Carson,

check ?rasterToPoints from raster package. That should do it!

Rafi

On 25.04.2012, at 12:26, Carson Farmer wrote:

> 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
> 
> -- 
> Dr. Carson J. Q. Farmer
> Centre for GeoInformatics (CGI)
> School of Geography and Geosciences
> Irvine Building, University of St Andrews
> St Andrews, Fife, KY16 9AL
> Scotland, UK
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



--
Rafael Wüest
Swiss Federal Research Institute WSL
Zürcherstrasse 111
8903 Birmensdorf
Switzerland

+41 44 7392126
rafael.wueest at wsl.ch
http://www.wsl.ch/info/mitarbeitende/wueest



More information about the R-sig-Geo mailing list