Global Administrative Areas (GADM) is a spatial database of the location of the world's administrative areas. Files are provided as Google Earth KMZ, shapefiles (.shp), ESRI geodatabase and as I was exited to see: as .RData files.
Download or load directly from the website.
This will create an object called gadm:
R:
-
library(sp)
-
# let's take a small country...
-
con <- url("http://gadm.org/data/rda/CHE_adm1.RData")
-
print(load(con))
-
close(con)
Conveniently, the object turns out to be a SpatialPolygonsDataFrame.
R:
-
str(gadm, max.level=2)
-
Formal class 'SpatialPolygonsDataFrame' [package "sp"] with 5 slots
-
..@ data :'data.frame': 27 obs. of 16 variables:
-
..@ polygons :List of 27
-
..@ plotOrder : int [1:27] 10 6 24 25 17 22 27 7 13 1 ...
-
..@ bbox : num [1:2, 1:2] 5.96 45.82 10.49 47.81
-
.. ..- attr(*, "dimnames")=List of 2
-
..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
Add some data (from http://www.all-about-switzerland.info/swiss-cantons.html)
R:
-
language <- c("german", "german", "german", "german","german","german","french","french","german","german","french", "french", "german", "french","german","german","german","german","german","german","german","italian","german","french","french","german","german")
-
-
gadm$language <- as.factor(language)
-
col = rainbow(length(levels(gadm$language)))
-
spplot(gadm, "language", col.regions=col, main="Swiss Language Regions")
nice!
No TweetBacks yet. (Be the first to Tweet this post)

Is there a way to set frame border to 0 o cut it from the plot? I didn't find any option in man page.
I suggest you check out ?par.
[...] Claudia Engel’s Anthrospace blog I found an R script already perfect to make use of the data provided. The Rdata files turn out to [...]
[...] Claudia Engel’s Anthrospace blog I found an R script already perfect to make use of the data provided. The Rdata files turn out to [...]