[R-sig-Geo] zero cost in gdistance

karljarvis karljarvis at gmail.com
Tue May 29 02:52:12 CEST 2012


Hi all,
I'd like to find cost distances in situations were some of the cells are 0,
to compare population genetic and landscape genetic results.  For example, a
landscape with panmixis on either side of a barrier. However, when I try it
in gdistance it gives the result "Inf" throughout in the matrix.

x <- c(-5,-5,5,5)
y <- c(-5,5,-5,5)
xy <- cbind(x,y)

m0 <- matrix(0,101,101)
m0[,51] <- 1
r0 <- raster(m0)
extent(r0) <- c(-10,10,-10,10)

t0 <- transition(r0,mean,8)
g0 <- geoCorrection(t0,type="c",multpl=FALSE)
c0 <- costDistance(g0,xy)

Is there a way to do this in R? 
I've heard that there are ways of doing cost distance in GRASS - does anyone
know if GRASS can deal with 0 resistance cells?
Karl


--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/zero-cost-in-gdistance-tp7579110.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list