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

Carson Farmer carson.farmer at gmail.com
Wed Apr 25 17:39:32 CEST 2012


Thanks Rafi,

Looks like that will do the trick, though now I just have to be
careful about memory management!

Carson

On Wed, Apr 25, 2012 at 11:45 AM, Rafael Wüest <rafael.wueest at wsl.ch> wrote:
> 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
>
>
>



-- 
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



More information about the R-sig-Geo mailing list