I would like to be able to plot my own values for a hand full of countries. For Example: China, United States, United Kingdom, Canada and Russia.
I have my own txt file that has 3 columns - ISO3V10, Country and No of Documents.
ISO3V10 Country No of Documents
CAN Canada 30
CHN China 20
RUS Russia 10
GBR United Kingdom 38
USA United States 50
The idea would be to have a world map coloured in for the Country
and the data being plotted is No of Documents
.
So far I have done this:
myData2 <- read.delim("noofdocuments.txt",header=T, sep='\t')
names(myData2)
myData2[]
jessdata <- data.frame(myData2=c("China", "United States", "United Kingdom",
"Russia", "Canada"))
sPDF <- joinCountryData2Map(jessdata,
joinCode = "NAME",
nameJoinColumn = "myData2")
par(mai=c(0,0,0.2,0),xaxs="i",yaxs="i")
mapCountryData(sPDF, nameColumnToPlot="REGION")
Ideally I would like sPDF to be:
sPDF <- joinCountryData2Map(countryExData,
joinCode = "ISO3", nameJoinColumn = "ISO3V10")
Also for REGION to be:
mapCountryData(sPDF, nameColumnToPlot="No.of.Documents")
I have tried all the ways possible to do this, which is why I have REGION as nameColumnToPlot as this is the only way I can get it too work.
Would someone be able to tell me where I have gone wrong in the code?