[R] Help with maps

Avram Aelony aavram at mac.com
Wed Dec 3 01:21:11 CET 2008


A few questions about maps...

(1) How can I find a listing of the internal data sets that map() from the maps library contains?
For example, "usa", "county", "state", "nz" all work.  Are there any others?

(2) Is there an easier, more generalized way to produce this (http://www.ai.rug.nl/~hedderik/R/US2004/ ) type of plot than this (http://www.ai.rug.nl/~hedderik/R/US2004/map.r ) ?  I have geographic (e.g. country, state, county, zip code) count data in a data frame that I would like to represent on a map, but still need to study how map.r works, especially the map.center function...

(3) The examples at http://had.co.nz/ggplot2/coord_map.html are great.  Adding another example that with color codes for counts from a data frame would be very useful too.

(4) Is there a reason why I can produce a map of France but not the UK ?   

>library(maps)
>library(ggplot2)
>library(mapproj)
>(qplot(x, y, data=(data.frame(map("france", plot=FALSE)[c("x","y")])), geom="path")) + coord_map()
>(qplot(x, y, data=(data.frame(map("uk", plot=FALSE)[c("x","y")])), geom="path")) + coord_map()
Error in get(dbname) : variable "ukMapEnv" was not found
In addition: Warning message:
In data(list = dbname) : data set 'ukMapEnv' not found

( version 2.8.0, on win xp currently)

Thanks in advance,
Avram



More information about the R-help mailing list