Hi Jim,
thanks again for your help! Yes I am using the "rworldmap" package.
identifyCountries() works.
But I am not entirley happy with this solution. You have to click on all 27 countries and when your position is not perfect you get e.g. "Vatican" or "Monaco" instead of "Italy" and you have to start all over again. Moreover when I maximize the picture all country-labels vanish or shift to the wrong place.
There ought to be a way to do it somehow more comfortable.

Have a nice sunda and best regards!

Claudia


.
Zitat von Jim Lemon <drjimle...@gmail.com>:

Hi Claudia,
It seems that you are using the "rworldmap" package. The simplest
solution to your problem seems to be the "identifyCountries" function.
Just call:

identifyCountries()

instead of "labelCountries" and left click on the countries you want labeled.

Jim


On Sat, Jan 17, 2015 at 3:33 AM,  <palad...@trustindata.de> wrote:
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

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to