[R] Introduction to maps (of Denmark)?

Greg Snow Greg.Snow at imail.org
Fri Feb 6 23:22:11 CET 2009


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,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Peter Jepsen
> Sent: Friday, February 06, 2009 1:18 PM
> To: r-help at r-project.org
> Subject: [R] Introduction to maps (of Denmark)?
> 
> 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
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list