Is there a way to obtain the list of countries, regions (?) and continents the rworldmap package supports when I want to join data?
I did some google searches and am just starting off with R.
Thanks.
On
Looking at one of the vignettes it appears that this should work:
require(rworldmap)
data(countryExData)
countries <- countryExData[, 2]
EPI_regions <- countryExData[, 3]
GEO_regions <- countryExData[, 4]
If you wanted to get the continental divisions taught in grammar school then there would be further processing needed on the GEO_regions:
> countryExData[ 1:10, 2:4]
Country EPI_regions
1 Angola Sub-Saharan Africa
2 Albania Central and Eastern Europ
3 United Arab Emirates Middle East and North Africa
4 Argentina Latin America and Caribbe
5 Armenia Middle East and North Africa
6 Australia East Asia and the Pacific
7 Austria Europe
8 Azerbaijan Central and Eastern Europ
9 Burundi Sub-Saharan Africa
10 Belgium Europe
GEO_subregion
1 Southern Africa
2 Central Europe
3 Arabian Peninsula
4 South America
5 Eastern Europe
6 Australia + New Zealand
7 Western Europe
8 Eastern Europe
9 Eastern Africa
10 Western Europe
On
I'm reasonably sure that the names are not the same as in the maps package. You can get a list of names and codes with this code.
library(rworldmap)
temp_map = getMap(resolution='coarse')
temp_map@data
The names are in temp_map@data[['NAME']].
However, it's a good idea to use one of the ISO code sets if you can. Names are extremely inconsistent between data sets, and sometimes frustrating differences will break it. For example, Cote d'Ivoire can be given with or without the circumflex, and the circumflex is sometimes encoded differently even though it is displayed the same.
It seems to me the
rworldmappackage provides some additional functionality on top of themapspackage.If this is indeed the case, you can do the following:
This extracts the
mapsdatabase, and the elementnamescontains the name for each map polygon. These names are in fact a multi-level list where the elements are separated by colons. For example, to get the list of polygons belonging to the UK: