rasterToPoints(x, fun=NULL, spatial=FALSE, ...)
TRUE
, the function returns a SpatialPointsDataFrame objectprogress
to specify a progress bar. "text", "window", or "" (the default, no progress bar)fun
should be a simple function returning a logical value
e.g.: fun=function(x){x==1}
or fun=function(x){x>3}
r <- raster(nrow=18, ncol=36)
r[] <- runif(ncell(r)) * 10
r[r>8] <- NA
p <- rasterToPoints(r)
p <- rasterToPoints(r, fun=function(x){x>6})
#plot(r)
#points(p)
Run the code above in your browser using DataLab