Description Usage Arguments Value Examples
returns world country polygons at a specified scale, or points of tiny_countries
1 2 3 |
scale |
scale of map to return, one of |
type |
country type, one of 'countries', 'map_units', 'sovereignty', 'tiny_countries' |
continent |
a character vector of continent names to get countries from. |
country |
a character vector of country names. |
geounit |
a character vector of geounit names. |
sovereignty |
a character vector of sovereignty names. |
returnclass |
'sp' default or 'sf' for Simple Features |
SpatialPolygonsDataFrame
,SpatialPointsDataFrame
or sf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | spdf_world <- ne_countries()
spdf_africa <- ne_countries(continent = 'africa')
spdf_france <- ne_countries(country = 'france')
if (require(sp)) {
plot(spdf_world)
plot(spdf_africa)
plot(spdf_france)
}
# get as sf
if (require(sf)) {
sf_world <- ne_countries(returnclass='sf')
plot(sf_world)
}
if (require(rnaturalearthdata) & require(sp)) {
spdf_tiny_countries <- ne_countries(type = 'tiny_countries', scale = 50)
plot(spdf_tiny_countries)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.