[R] Can I create an European map using the map function in R
Ray Brownrigg
Ray.Brownrigg at ecs.vuw.ac.nz
Wed Jul 28 05:35:10 CEST 2010
On Tue, 27 Jul 2010, Maomao Luo wrote:
> Hi,
>
> I am trying to create a spatial weight matrix based on the neighboring
> relationship among Europan countries. Can I use the map function in R to
> generate a European map and then use this map to build the w weight matrix?
> So far, I cannot create a map for Finland using the map function.
>
It is not clear to me what you mean by "... use this map to build the w weight matrix".
How can you use an image on the screen to generate a matrix?
However, to get the map of Europe using the maps package, try something like this:
library(maps)
m <- map("world", xlim=c(-10, 30), ylim=c(35, 60))
Europe <- sort(m$names)
fix(Europe) # remove anything you don't need
map("world", Europe, exact=T)
Note for example, you will need to leave in "UK:Great Britain" and "UK:Northern Ireland",
since there is no country called "UK". Similarly, Malta is named as "Malta:Malta".
Hope this helps,
Ray Brownrigg
>
> Also, I am not very sure about the steps in importing external map data and
> use that information to generate a spatial weight matrix in R. Could
> anyone show me how to implement this using European countries as an
> example?
>
Pass.
> Thanks a lot for your help.
>
> Maomao
More information about the R-help
mailing list