[R-sig-Geo] Best way to get values of a raster that are not masked?

Robert J. Hijmans r.hijmans at gmail.com
Thu Jun 3 02:45:47 CEST 2010


Hi Jonathan,

The function rasterToPoints does that. Its default behavior is to
returns a matrix with coordinates and values for all cells that are
not NA.
You can also ask for cells with a specific range of values, and for a
SptialPointDataFrame.

Robert


On Wed, Jun 2, 2010 at 5:27 PM, Jonathan Greenberg
<greenberg at ucdavis.edu> wrote:
> I've got a file and a mask (1s for "good data", NAs for "bad"), and I
> want to extract the cell values AND geographic coordinates of these
> cells into a data frame or vector that correspond to the locations
> where the mask is 1 -- what is the best practice for doing this?  I
> can loop through each row/block and do the query, but is there a
> "cleaner" way of approaching this in raster()?
>
> --j
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



More information about the R-sig-Geo mailing list