Hi List,<br><br>I've imported a SpatialGridDataFrame (SGDF) from GRASS with spgrass, and now I'm trying to select only those entries with a certain value in a column. What is the appropriate syntax for selecting cells in a grid that have particular values? Here's what I have:<br>
<br>----------<br>> summary(modelRast)<br>Object of class SpatialGridDataFrame<br>Coordinates:<br> min max<br>x 174812.5 382055.5<br>y 1798172.6 1942292.8<br>Is projected: TRUE <br>proj4string :<br>[+proj=utm +zone=16 +a=6378137 +rf=298.257223563 +no_defs<br>
+towgs84=0.000,0.000,0.000 +to_meter=1.0]<br>Number of points: 2<br>Grid attributes:<br> cellcentre.offset cellsize cells.dim<br>x 174820 15.00021 13816<br>y 1798180 15.00002 9608<br>Data attributes:<br>
Value 1 NA's <br> 1534000 131210128 <br>----------<br><br>So, the SGDF obviously 'knows' which cells are NA and which are 1, but how do I select cells on the basis of a column value?<br><br>Also, is there a way to write values into a column in the SGDF without having to create a new df object and then combine them? For example, how do I:<br>
<br>---pseudo code---<br>for cell in sgdf {<br>thing = calculate_something(cell)<br>write2grid(cell, thing)<br>}<br>------------------------<br><br>I haven't been able to work this out on my own or find any examples of this type of selection online (been searching a while... ) though I might be looking in the wrong places. Thanks,<br>
<br>Chris<br>