Skip to content

Introduction to maps (of Denmark)?

3 messages · Peter Jepsen, Greg Snow, Kingsford Jones

#
Dear R-listers,

I am using R for Windows Vista 64-bit. I have no experience working with
maps, but now I have to plot a map of Denmark in which each Danish
county is color-coded according to its incidence rate of a particular
disease. My problem is that I don't know where to start. I have read the
help files to packages like 'mapplot', and their examples indicate that
I am on the right track, but where do I find a suitably detailed map of
Denmark, and which format should I prefer? The terminology in the help
files etc. is overwhelming.

Thank you in advance for any help.

Best regards,
Peter.

***
R version 2.8.1 (2008-12-22) 
i386-pc-mingw32 

locale:
LC_COLLATE=Danish_Denmark.1252;LC_CTYPE=Danish_Denmark.1252;LC_MONETARY=
Danish_Denmark.1252;LC_NUMERIC=C;LC_TIME=Danish_Denmark.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base
#
Googling for Denmark Shapefile leads to this website: http://www.vdstech.com/map_data.htm
Where a few clicks lead to downloading a set of shapefiles (different levels of subdividing the country, hopefully you know more about what they correspond to than I do, about all I know about Denmark is from Hamlet, the fact that I have some ancestors from there (but I don't remember which branch), and how to make aebleskivers).  

These can be read into R using the maptools package as:

library(maptools)
dmk1 <- readShapePoly('g:/downloads/DNK_adm/DNK0')
dmk2 <- readShapePoly('g:/downloads/DNK_adm/DNK1')
dmk3 <- readShapePoly('g:/downloads/DNK_adm/DNK2')

simple plots can be done like:

plot(dmk1)
plot(dmk2)
plot(dmk3)

a little more complex with:

plot(dmk3, col=topo.colors(248))

though of course replacing topo.colors(248) with something that is meaningful.  If you need more control, then see the sp package.

Hope this helps,
#
Also, see this page for more ideas on mapping an auxiliary variable by county:

http://r-spatial.sourceforge.net/gallery/

(e.g. plots 9, 14, 15 and 21)


Kingsford Jones
On Fri, Feb 6, 2009 at 3:22 PM, Greg Snow <Greg.Snow at imail.org> wrote: