[R] labelCoubtries() doesn't work. Where is my mistake?

paladini at trustindata.de paladini at trustindata.de
Fri Jan 16 17:33:12 CET 2015


Hello,
I have problems to label countries in my map.

I use the following code to draw the map:


epimap=joinCountryData2Map(epidata,joinCode="NAME",nameCountryColumn="Country",nameJoinColumn="Country")
mapCountryData(epimap, nameColumnToPlot="EPI.2.0" ,mapRegion="europe",  
oceanCol="slateblue1",
missingCountryCol="darkgrey",  
colourPalette=c("palegreen","darkgreen"), mapTitle="European  
Participation Index")

That works without any problems.

  When I use labelCountries() afterwards all countries are named,  
including Isle of Man, San Marino etc.
  and the map becomes quite confusing.

Therefore I want to label only the 27 countries contained in my data.

In order to get their coordinates I use the following routine:

country_index= c()
j=1
for (i in 1:244){
	if  (!is.na(epimap[["Country"]][i])){
		country_index[j]=i
		j=j+1
	}



}

LON=epimap[['LON']][namei]
LAT=epimap[['LAT']][namei]

epidata_spat=cbind(epidata, LON,LAT)

It is a bit pedestrian but I dont't know how to do it more elegantly.
Nevertheless it works.

Now I use


labelCountries(dF="epidata_spat",nameCountryColumn ="Country",  
nameX="LON", nameY="LAT")


But nothing happens. There is neither an error message nor country-labels.

I haven't the faintest idea why it doesn't work or how to do it properly.
It would be really nice if somebody could help me.



Best regards and thanking you in anticipation!

Claudia



More information about the R-help mailing list