what should I do?
liamxg opened this issue · 6 comments
Dear @edzer,
> fortify(ind_poly, region = "NAME_1")
Error:
! `fortify(<SpatialPolygonsDataFrame>, region = ...)` is defunct' was deprecated in ggplot2 3.4.4 and is now
defunct.
ℹ Please migrate to sf.
Run `rlang::last_trace()` to see where the error occurred.
Warning message:
`fortify(<SpatialPolygonsDataFrame>)` was deprecated in ggplot2 3.4.4.
ℹ Please migrate to sf.
This warning is displayed once every 8 hours.
Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
use st_as_sf(ind_poly)
, and check out how geom_sf()
is used as a geom for ggplot2
.
Dear @edzer,
ind_poly
is downloaded from https://gadm.org/.
No, you are not looking at current GADM 4.1, which offers GeoPackage, ESRI Shapefile, GeoJSON or KML downloads only. Version 2.8 provided sp vector objects in rds format, in addition to standard file formats, while 3.6 added sf vector objects in rds format.
There is no reason whatsoever to assume that using gadm means using objects in sp vector format in rds files. The terra
package certainly does not. fortify
was never a good idea and is defunct.
If using sf
, download a GeoPackage file, read with st_read
, and if using ggplot2
, plot with geom_sf
.
If reproducing very outdated work, install from source the package versions used then on R from that time.
Dear @rsbivand,
Excellent of your reply, thanks.
BTW, any tutorials on show the GADM data with outside data for example population data on map?
Please see the help page for merge
: https://r-spatial.github.io/sf/reference/merge.sf.html.
Thanks.