Skip to content

Instantly share code, notes, and snippets.

@thomaskern
Created February 18, 2011 16:22
Show Gist options
  • Save thomaskern/833906 to your computer and use it in GitHub Desktop.
Save thomaskern/833906 to your computer and use it in GitHub Desktop.
library(maptools)
gpclibPermit()
load("worldmap.rdata")
library(ggplot2)
Sys.setlocale("LC_ALL", locale = "C")
world.ggmap <- fortify(world.map, region = "NAME")
elect.gen.tot = read.csv("world_counted.txt",sep=",", dec=".")
names(elect.gen.tot) <- c("id", "y2007","foo")
elect.gen.tot$id <- tolower(elect.gen.tot$id)
world.ggmap$id <- tolower(world.ggmap$id)
world.ggmape <- merge(world.ggmap, elect.gen.tot, by = "id", all = TRUE)
world.ggmape <- world.ggmape[order(world.ggmape$order), ]
world.plot <- ggplot(data = world.ggmape, aes(x = long, y = lat, group = group))
p = world.plot + geom_polygon(aes(fill = y2007))
print(p)
id,counter,cid
cocos (keeling) islands,1,CC
guatemala,26,GT
japan,603144,JP
sweden,27163,SE
burma,2,MM
united republic of tanzania,1,TZ
democratic republic of the congo,1,CD
guam,12,GU
algeria,7,DZ
mongolia,29,MN
pakistan,56,PK
singapore,4794,SG
macau,16,MO
poland,667,PL
saint pierre and miquelon,5,PM
slovenia,294,SI
venezuela,565,VE
martinique,1,MQ
zimbabwe,9,ZW
switzerland,34734,CH
guyana,6,GY
cote d'ivoire,2,CI
slovakia,129,SK
virgin islands,37,VG
sierra leone,6,SL
cook islands,1,CK
indonesia,141,ID
malta,38,MT
san marino,4,SM
virgin islands,9,VI
yemen,3,YE
chile,337,CL
ireland,3182,IE
lao people's democratic republic,3,LA
mauritius,5,MU
senegal,3,SN
cameroon,8,CM
finland,15087,FI
lebanon,73,LB
puerto rico,82,PR
fiji,3,FJ
china,11285,CN
saint lucia,1,LC
malawi,1,MW
falkland islands (malvinas),1,FK
colombia,205,CO
mexico,1848,MX
portugal,289,PT
suriname,4,SR
malaysia,1220,MY
viet nam,20,VN
mozambique,1,MZ
costa rica,132,CR
faroe islands,3,FO
israel,21282,IL
liechtenstein,294,LI
paraguay,6,PY
bosnia and herzegovina,24,BA
cuba,112,CU
el salvador,16,SV
france,86390,FR
india,6429,IN
sri lanka,36,LK
barbados,22,BB
british indian ocean territory,2,IO
vanuatu,1,VU
christmas island,1,CX
ukraine,329,UA
syrian arab republic,14,SY
cyprus,58,CY
iraq,9,IQ
swaziland,11,SZ
bangladesh,12,BD
czech republic,470,CZ
iran (islamic republic of),98,IR
belgium,14247,BE
iceland,311,IS
croatia,248,YU
burkina faso,14,BF
ecuador,46,EC
italy,35641,IT
oman,7,OM
bulgaria,436,BG
bahrain,8,BH
liberia,1,LR
uganda,6,UG
estonia,76,EE
lithuania,44,LT
egypt,137,EG
luxembourg,710,LU
romania,139,RO
bermuda,62,BM
latvia,45,LV
brunei darussalam,2,BN
bolivia,19,BO
kenya,53,KE
namibia,2,NA
libyan arab jamahiriya,2,LY
brazil,2347,BR
kyrgyzstan,4,KG
new caledonia,10,NC
bahamas,176,BS
hong kong,3539,HK
niger,6,NE
qatar,6,QA
russia,3318,RU
norfolk island,3,NF
honduras,18,HN
nigeria,34,NG
spain,6383,ES
ethiopia,4,ET
nicaragua,3,NI
andorra,10,AD
belarus,80,BY
united arab emirates,94,AE
belize,5,BZ
croatia,205,HR
saint kitts and nevis,12,KN
turks and caicos islands,11,TC
afghanistan,1,AF
netherlands,30575,NL
chad,6,TD
antigua and barbuda,12,AG
haiti,6,HT
korea,37,KP
uruguay,74,UY
gabon,10,GA
hungary,2024,HU
uzbekistan,11,UZ
anguilla,6,AI
germany,212271,DE
united kingdom,84560,GB
korea,81170,KR
norway,5102,NO
thailand,445,TH
nepal,2,NP
grenada,1,GD
south africa,3067,ZA
albania,5,AL
georgia,41,GE
french guiana,1,GF
tokelau,4,TK
armenia,32,AM
netherlands antilles,17,AN
djibouti,1,DJ
kuwait,108,KW
angola,3,AO
denmark,9876,DK
niue,1,NU
ghana,10,GH
morocco,60,MA
cayman islands,58,KY
tunisia,25,TN
dominica,3,DM
gibraltar,16,GI
kazakhstan,24,KZ
monaco,175,MC
argentina,1084,AR
republic of moldova,16,MD
american samoa,1,AS
dominican republic,33,DO
greenland,2,GL
panama,70,PA
turkey,353,TR
austria,10424,AT
gambia,6,GM
new zealand,2965,NZ
australia,20418,AU
guinea,1,GN
madagascar,2,MG
marshall islands,3,MH
trinidad and tobago,38,TT
aruba,8,AW
peru,76,PE
saudi arabia,345,SA
guadeloupe,3,GP
samoa,1,WS
french polynesia,6,PF
solomon islands,1,SB
canada,73801,CA
jamaica,37,JM
seychelles,236,SC
taiwan,89555,TW
azerbaijan,22,AZ
greece,566,GR
the former yugoslav republic of macedonia,4,MK
papua new guinea,3,PG
sudan,1,SD
jordan,57,JO
mali,6,ML
philippines,386,PH
united states,1611403,US
guinea-bissau,0,muh
sao tome and principe,0,muh
korea, republic of,0,muh
svalbard,0,muh
turkmenistan,0,muh
tajikistan,0,muh
nauru,0,muh
bhutan,0,muh
cape verde,0,muh
timor-leste,0,muh
serbia,0,muh
micronesia, federated states of,0,muh
saint helena,0,muh
equatorial guinea,0,muh
somalia,0,muh
northern mariana islands,0,muh
french southern and antarctic lands,0,muh
lesotho,0,muh
thailand the form,0,muh
tonga,0,muh
togo,0,muh
mayotte,0,muh
zambia,0,muh
south georgia south sandwich islands,0,muh
united states virgin islands,0,muh
reunion,0,muh
maldives,0,muh
er yugoslav republic of macedonia,0,muh
bouvet island,0,muh
central african republic,0,muh
benin,0,muh
palau,0,muh
holy see (vatican city),0,muh
isle of man,0,muh
korea, democratic people's republic of,0,muh
jersey,0,muh
heard island and mcdonald islands,0,muh
botswana,0,muh
montserrat,0,muh
saint barthelemy,0,muh
cambodia,0,muh
united states minor outlying islands,0,muh
wallis and futuna islands,0,muh
comoros,0,muh
saint vincent and the grenadines,0,muh
burundi,0,muh
rwanda,0,muh
tuvalu,0,muh
montenegro,0,muh
eritrea,0,muh
kiribati,0,muh
guernsey,0,muh
congo,0,muh
british virgin islands,0,muh
western sahara,0,muh
saint martin,0,muh
palestine,0,muh
mauritania,0,muh
antarctica,0,muh
pitcairn islands,0,muh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment