[R-sig-Geo] Error message when trying to compute the least cost path in gdistance in R
Giacomo May
Giacomo_May94 at gmx.de
Tue Aug 9 15:54:52 CEST 2016
Dear R users,
I am trying to compute the least cost path between two points (A and B ) based on a transition matrix in R using the gdistance package. I have a resistance grid (resistance) with high cell values representing high resistance. My code so far is the following:
trCost <- transition(1/resistance,mean,directions = 8)
trCost <- geoCorrection(trCost)
sP <- shortestPath(trCost,A,B, output="SpatialLines")
However, shortly after I give the above commands, R displays the following error message:
Error in if (is.numeric(v) && any(v < 0)) { : missing value where TRUE/FALSE needed
Has anyone ever dealt with this issue before ? Any help will be greatly appreciated !
More information about the R-sig-Geo
mailing list