During script execution I need to convert 'RasterBrick' to 'im' object. Package 'geostatsp' is supposed to do this job:
library(geostatsp)
myraster = raster(matrix(1:100,10,10), xmn=0,xmx=10,ymn=0,ymx=10)
class(myraster)
>[1] "RasterLayer"
>attr(,"package")
>[1] "raster"
myIm = as.im(myraster)
class(myIm)
>[1] "im"
But when I try it with real data I catch an error:
library(geostatsp)
b <- brick(some_file)
r <- raster(b)
class(r)
>[1] "RasterLayer"
>attr(,"package")
>[1] "raster"
bim <- as.im(r)
>Error in .local(x, ...) : 'x' has no values
What causes this?