Hi Jordan,

Not that I know of, but I will write one for the raster package. For now,
the below might work

Best, Robert

library(raster)

# set up a stack with three layers
r <- raster(nr=10, nc=10)
s <- stack(sapply(1:3, function(x) setValues(r, round(runif(ncell(r))))))

# unique values
us <- unique(s)

# unfortunately, raster::reclass does not for several layers at
once (something for the to do list)
# an inefficient work around

uss <- apply(us, 1, function(x)paste(x, collapse='_'))
comb <- function(x) match(apply(x, 1, function(x)paste(x, collapse='_')),
uss)

x <- calc(s, comb)
plot(x)


On Thu, Nov 24, 2011 at 8:39 AM, Jordan Chamberlin <[email protected]> wrote:

> Hello list,
>
> Is there something like a combine function in R? I'm thinking of the
> COMBINE function in the old ArcInfo (which gives a grid of unique cell-wise
> combinations of integer values in a set of input grids). There must be
> something like that already written for R, but I'm new to this, so I'm
> grateful for pointers in the right direction.
>
> Jordan
>
> ______________________________**_________________
> R-sig-Geo mailing list
> [email protected]
> https://stat.ethz.ch/mailman/**listinfo/r-sig-geo<https://stat.ethz.ch/mailman/listinfo/r-sig-geo>
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to