The function map
can be used to load the "world" data. We need to convert it to a "simple features" object via st_as_sf()
:
worldmap_data <- st_as_sf(map('world', plot = FALSE, fill = TRUE))
head(worldmap_data, n = 3) # to have a look inside
## Simple feature collection with 3 features and 1 field
## geometry type: MULTIPOLYGON
## dimension: XY
## bbox: xmin: -8.68335 ymin: 18.98662 xmax: 74.89131 ymax: 42.64795
## epsg (SRID): 4326
## proj4string: +proj=longlat +datum=WGS84 +no_defs
## geometry ID
## 1 MULTIPOLYGON (((74.89131 37... Afghanistan
## 2 MULTIPOLYGON (((20.06396 42... Albania
## 3 MULTIPOLYGON (((8.576563 36... Algeria
- spatial dataset with a "header" giving some general information
- two columns:
geometry
(spatial data) and ID
(attribute)
What do the numbers in the geometry
column mean? What's their CRS?