[R] German Map in package maps

Duncan Murdoch murdoch at stats.uwo.ca
Tue May 22 23:11:17 CEST 2007


On 22/05/2007 2:58 PM, Maja Schroeter wrote:
> Hello everybody,
> 
> I'm an absolute newbe in R, so please be gentle to me.
> 
> I am looking for a german map in the package maps by Becker and Wilks.
> 
> After that I want to draw the German cities from world.cities of this
> package in the map and want to draw further a line from Berlin to Munich.
> 
> Has anybody an idea?

How about this:

library(mapdata)
map("worldHires", "Germany")
map.cities(country="Germany")
Berlin <- subset(world.cities, name=="Berlin" & country.etc=="Germany")
Munich <- subset(world.cities, name=="Munich" & country.etc=="Germany")
segments(Berlin$long, Berlin$lat, Munich$long, Munich$lat)

Duncan Murdoch



More information about the R-help mailing list