[R] political maps world maps in R, wrld_simpl

Roger Bivand Roger.Bivand at nhh.no
Tue Apr 7 13:44:14 CEST 2009


Patrizio Frederic <frederic.patrizio <at> gmail.com> writes:

> 
> dear all,
> I'm a newbie in map tools. I was asking to perform an apparently very
> simple task.
> I have a list of countries (about fifty all over in the world) scored
> with a real positive value. Eg
> ...
> 
> I wish to plot geographical maps where every country is filled with a
> color depending on his score.
> Using maptools library and wrld_simpl I can easily perform the world
> map. 

Note that the file is included in recent releases of maptools, so just say 

data(wrld_simpl)

> library(maptools)
> load(url("http://spatial.nhh.no/R/etc/TM_WORLD_BORDERS_SIMPL-0.2.RData"))

For matching the countries you have with the countries in the object (note
that names may differ), I suggest simply adding ISO3 codes to your data 
frame, and using them as row names as well. Look at the spCbind methods in
maptools.

> Now what if I wish to zoom on some sub world regions such as Eastern
> Europe or America or any other user defined contiguous sub group?

Either select using [ or plot using xlim/ylim arguments

> 
> Russia is a large country I could be interested in cutting it in two
> peaces eastern and western. Can I do it using wrld_simpl or should I
> search for other data? If so where can I find free maps data?

You can plot part of Russia with the object as it is by using xlim/ylim
arguments. You can manipulate low-level objects if you need to, but
it is not easy unless you know what you are doing.

> 
> Some documentation exists but it seems sparse to me.

The R-sig-geo list is more focussed on this kind of question, as is pointed 
out on the Spatial Task View on CRAN. 

Hope this helps,

Roger Bivand

> Any hints will be appreciated.
> Thanks in advance,
> 
> Patrizio




More information about the R-help mailing list