Closed dsteinke2017 closed 2 years ago
This is not the place for general "how to" questions. I would suggest stackoverflow or gis.stackexchange,com. In either case, please make your script reproducible. For example, you need to include the libraries and (example) data used.
Anyway, what you can do is something along these lines:
library(geodata)
cri = gadm("Costa Rica", level=1, path=".")
# fake "ecoregions" data
ecoregions <- as.polygons(rast())
x <- crop(r, cri)
plot(x)
Hi there, I am getting this error: Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘extent’ for signature ‘"SpatVector"’
I modified some code by Russell J Gray (https://www.rjgrayecology.com/blog/ecoregions-maps-in-r#/) to build a bounding box around one country to later display a map with ecoregions within it. Works fine until I am trying to use crop (leads to error). Here the part of the code:
Many thanks for any help. Tried this in terra as well, same result.