Skip to content
Prev 10947 / 29559 Next

comparison (1) is possible only for atomic and list types

Nikki,

I'm not sure whether I understood what you are trying to do, but if you just want to replace values
in a column of a SpatialGridDataFrame, sp comes with all the methods you need. Example:

library(sp)
data(meuse.grid)
coordinates(meuse.grid) <- ~x+y
meuse.grid <- as(as(meuse.grid, "SpatialPixelsDataFrame"),"SpatialGridDataFrame")
spplot(meuse.grid[,,"soil"])

meuse.grid$soil[meuse.grid$soil==1] <- 4
meuse.grid$soil[meuse.grid$soil==2 | meuse.grid$soil==3] <- 5
spplot(meuse.grid[,,"soil"])

Hope that helps,
Tom