Reputation: 686
I have been trying to get a graph from using distance()
in the raster
package. The raster dimensions are inherited from a SpatialPointsDataFrame
. The raster works fine until I try distance(raster)
and get the following warning:
Warning message:
In matrix(v, ncol = tr$nrows[1] + 3) :
data length [8837790] is not a sub-multiple or multiple of the number of rows [4384]
The bizarre thing is the raster works at smaller resolution but not large. The error can be replicated below:
Fails:
library(raster)
r <- raster(ncol=4386,nrow=6039)
r[] <- NA
r[500] <- 1
dist <- distance(r)
plot(dist / 1000)
Works:
r <- raster(ncol=438.6,nrow=603.9)
r[] <- NA
r[500] <- 1
dist <- distance(r)
plot(dist / 1000)
Why? Have I missed something really obvious?
Upvotes: 1
Views: 94
Reputation: 686
An update to raster_2.4-20 solved the problem. Thanks Pascal and RobertH for pointing me in the right direction.
Upvotes: 1