An R package to hold and facilitate interaction with Natural Earth map data.
This package provides :
access to a pre-downloaded subset of Natural Earth v4.1.0 (March 2018) vector data commonly used in world mapping
easy subsetting by countries and regions
functions to download other Natural Earth vector and raster data
a simple, reproducible and sustainable workflow from Natural Earth data to rnaturalearth enabling updating as new versions become available
clarification of differences in world maps classified by countries, sovereign states and map units
consistency with Natural Earth naming conventions so that rnaturalearth users can use Natural Earth documentation
data in ‘sf’ or ‘sp’ formats
The Natural Earth website structures vector data by scale, category and type. These determine the filenames of downloads. rnaturalearth uses this structure to facilitate download (like an API).
s## Install rnaturalearth
Install from CRAN :
or install the development version from GitHub using devtools.
Data to support much of the package functionality are stored in two data packages that you will be prompted to install when required if you do not do so here.
sp::plot as a simple, quick way to plot maps. Maps could also be made with
tmap or other options. All retrieval functions accept an argument
returnclass='sf' to return package
sf (Simple Features) objects.
# uk sp::plot(ne_countries(country = "united kingdom"))
# states, admin level1 boundaries sp::plot(ne_states(country = "spain"))
vignette("rnaturalearth", package = "rnaturalearth")
There are a wealth of other data available at the Natural Earth website.
rnaturalearth has functions to help with download of these data.
The data available are outlined in the two tables below and online here.
category cultural category physical
type of the vector you want as in the examples below.
vignette("what-is-a-country", package = "rnaturalearth")
Script used to get data into the accompanying data packages.
Thanks to Lincoln Mullen for code structure inspiration from USAboundaries, Hadley Wickham for comments and prompting, Bob Rudis for answers to stackoverflow questions about downloading Natural Earth data into R. The Natural Earth team and Nathan Kelso for providing such a great resource.
- Country synonyms lookup
- dataframe with ISO3 and country synonyms
- similar to https://github.com/AndySouth/rworldmap/blob/master/data/countrySynonyms.rda
- Country larger regions lookup
- dataframe with ISO3 and membership of different regional groupings, e.g. continent, least developed countries etc.
- similar to https://github.com/AndySouth/rworldmap/blob/master/data/countryRegions.rda
- facilitate joining of user data to country boundaries
- similar to https://github.com/AndySouth/rworldmap/blob/master/R/joinCountryData2Map.R
- … but with a better name
- similar allowing of join by ISO codes or names, with attempted synonym matching
- similar reporting of country joining success and failure
- facilitate subsetting by country groupings
- e.g. least developed countries etc.