Skip to content
Prev 2330 / 29559 Next

map algebra with ascii grid

On Sat, 14 Jul 2007, Michal Gallay wrote:

            
Arithmetic operations are not defined for SpatialGridDataFrame operations, 
as the columns of the data frame (here a single column) may contain data 
of different classes. Do the operations on the columns directly:

names(x)

If there is a column called "band1", then

x$band1 + 3

will print "band1" + 3, and

x$band1 <- x$band1 + 3

will add 3 to the "band1" column. Think what would happen if band1 was 
categorical or logical to see why doing arithmetic directly isn't such a 
good idea.

Hope this helps,

Roger