Hello everyone,
I'm new to this list and to using R for geographical data analysis. I am
playing around with the gdistance package but have a small problem:
I am trying to use a RasterLayer to define origin and goal points for the
passage function, which I believe is possible based on the documentation:
origin
SpatialPoints, matrix or numeric object with coordinates or RasterLayer
object with origin cells set to TRUE
goal
SpatialPoints, matrix or numeric object with coordinates or RasterLayer
object with origin cells set to TRUE
Here is a basic idea of what I'm doing:
####################################
map.test <- raster(ncol=10,nrow=10)
map.test[] <- 100
origin <- raster(ncol=ncol(map.test),nrow=nrow(map.test))
origin[] <- FALSE
origin[93] <- TRUE
goal <- raster(ncol=ncol(map.test),nrow=nrow(map.test))
goal[] <- FALSE
goal[9] <- TRUE
tran.test <- transition(map.test,transitionFunction=mean,directions=8)
passage(tran.test, origin, goal,theta=0,totalNet=total)
and this gives the error message:
Error in which(getValues(origin)) : argument to 'which' is not logical
##################################
Any ideas what I'm doing wrong?
Thanks very much
Josephine
[[alternative HTML version deleted]]
_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo