[R-sig-Geo] cleaning up a SpatialGridDataFrame
Robert Hijmans
r.hijmans at gmail.com
Tue Mar 8 03:00:02 CET 2011
> I have an image which is a SpatialGridDatafFrame. This image has a number
of
> cells that i need to erase or to delete but i don`t know how to do this in
> R.
Mary,
It is not clear what you mean with "erase or delete".
If you refer to setting some cell values to NA you can do, with
SpatialGridDataFrame x, things like
x at data[2:5,] <- NA
or make a RasterLayer
library(raster)
r <- raster(x)
x[2:5] <- NA
x[1:2, 1:2] <- NA
or use raster package functions like 'reclass', 'subs', or 'cut'
If you refer to removing entire rows or columns from your grid, you can use
function 'crop' and perhaps 'trim'
Robert
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/cleaning-up-a-SpatialGridDataFrame-tp6087994p6099877.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
More information about the R-sig-Geo
mailing list