[R-sig-Geo] Creating a spatial grid from table and x & y break vectors?

stepen.condors at gmail.com stepen.condors at gmail.com
Thu Mar 31 05:21:04 CEST 2011


Hi all,
I have the following datasets and am trying to generate a spatial grid which can be plotted (somewhat like the object created by spatstat's quadratcount):

Dataset 1: A table containing a known number of cells, each value relating to the intensity at a given cell.

> str(gridData)
 table [1:250, 1:400] 0 0 0 0 0 0 1.72 0 0 0 ...
 - attr(*, "dimnames")=List of 2
  ..$ : chr [1:250] "A" "B" "C" "D" ...
  ..$ : chr [1:400] "A" "B" "C" "D" ...

Datasets 2&3: vectors of xbreaks and ybreaks - specifying the eastings and northings of the grid cells I want to plot.

> str(xbrks)
 num [1:401] 1740000 1740100 1740200 1740300 1740400 ...

> str(ybrks)
 num [1:251] 5420000 5420100 5420200 5420300 5420400 ...


Given these three datatsets, what would be the easiest way to turn this into a plottable (spatially located) grid, that I can then overlay ppp onto? 

I am aware that I can simply plot the table as an image, but obviously this is not spatially referenced in anyway so I wouldn't then be able to overlay a point data set and allow the pts and grid polygons to interact. 

Any assistance is greatly appreciated.
Stepen


More information about the R-sig-Geo mailing list