0

I just started learning GIS via R, and I am using the raster package. It gives me the following error when I use the geodata package.

Error: 'geodata' is not an exported object from 'namespace:raster'

I used the following code:

States <- raster::geodata(name = "GADM",
                          country = "United States",
                          level = 1,
                          path = "path/to/save/file",
                          download = TRUE)

Found something similar on Stack Echange already answered here ('data' is not an exported object from 'namespace:my_package') but I believe it was a different context.

  • Which function from the `geodata` package are you trying to use? The syntax is `package::function()`. It wont work to run `raster::geodata` since both are packages. Try `geodata::some_function()` – nniloc Sep 14 '22 at 06:37

1 Answers1

0

raster::geodata simply does not exist (and that is what the message tells you).

You are probably looking for the outdated:

States <- raster::getData("GADM", country = "United States",
                      level = 1, path = ".")

And mixing that up with the replacement

s <- geodata::gadm("United States", level = 1, path = ".")

(but note that geodata returns "terra" objects. "terra" is the replacement of "raster")

Robert Hijmans
  • 40,301
  • 4
  • 55
  • 63