You can find out which cell has your coordinates via

cellFromXY(object, xy)


and subset your data based on those cells using the standard "[" method.


Cheers,
Roman


On Thu, Feb 9, 2012 at 4:29 PM, Thiago Veloso <thi_veloso@yahoo.com.br>wrote:

>  Dear list,
>
>  I wonder if there is a way to change the values of a raster grid using
> the coordinates as a condition. Please consider the raster below:
>
> > library(raster)
> > amz<-raster("/home/data/amz.img")
> > amz
> class       : RasterLayer
> dimensions  : 47, 65, 3055  (nrow, ncol, ncell)
> resolution  : 0.5, 0.5  (x, y)
> extent      : -74, -41.5, -17.5, 6  (xmin, xmax, ymin, ymax)
> coord. ref. : NA
> values      : /home/data/amz.img
> min value   : 0
> max value   : 1
>
>  This is what I would like to do:
>
> >amz[-55,2]<-0.5
>
>  Package "raster" offers a 'replacement' function that seemed promising,
> but its arguments are row and column numbers, instead of coordinates.
>
>  Could anyone please point out another option?
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



-- 
In God we trust, all others bring data.

	[[alternative HTML version deleted]]

