Re: [R] Selecting contiguous, irregularly-shaped sets of values from arrays

2012-02-06 Thread Bryan McCloskey
Chris, That worked exceptionally well. Here's the pseudo-code for what I ended up using: library(spatstat) depth_bin<-depth<-stage-elevation #depth at grid cells = stage matrix - elevation matrix; initialize binary matrix depth_bin[,]<-depth>5 #binary matrix of cells >5cm deep depth_con_im<-con

Re: [R] Selecting contiguous, irregularly-shaped sets of values from arrays

2012-02-01 Thread Chris Campbell
Dear Bryan, You could try using spatial techniques to choose the contiguous areas of your matrices. > require(spatstat) > set.seed(1520) > x <- matrix(rnorm(25), nrow=5, ncol=5, + dimnames=list(c("A","B","C","D","E"), c("v","w","x","y","z"))) > x vw x