Maomao Luo
2010-Jul-27 02:06 UTC
[R] Can I create an European map using the map function in R
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. 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? Thanks a lot for your help. Maomao _________________________________________________________________ The New Busy is not the old busy. Search, chat and e-mail from your inbox. N:WL:en-US:WM_HMP:042010_3 [[alternative HTML version deleted]]
Ray Brownrigg
2010-Jul-28 03:35 UTC
[R] Can I create an European map using the map function in R
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