Skip to content

Instantly share code, notes, and snippets.

@csiu
Created November 1, 2015 22:40
Show Gist options
  • Save csiu/832bc51d373ce65e6a04 to your computer and use it in GitHub Desktop.
Save csiu/832bc51d373ce65e6a04 to your computer and use it in GitHub Desktop.
Average number of bad teeth per child (12 yr) in 2004 with regional information
country bad_teeth alpha.2 alpha.3 country.code iso_3166.2 region sub.region region.code sub.region.code
Afghanistan 2.9 AF AFG 4 ISO 3166-2:AF Asia Southern Asia 142 34
Albania 3.02 AL ALB 8 ISO 3166-2:AL Europe Southern Europe 150 39
Algeria 2.3 DZ DZA 12 ISO 3166-2:DZ Africa Northern Africa 2 15
Angola 1.7 AO AGO 24 ISO 3166-2:AO Africa Middle Africa 2 17
Anguilla 2.5 AI AIA 660 ISO 3166-2:AI Americas Caribbean 19 29
Antigua and Barbuda 0.7 AG ATG 28 ISO 3166-2:AG Americas Caribbean 19 29
Argentina 3.4 AR ARG 32 ISO 3166-2:AR Americas South America 19 5
Armenia 2.4 AM ARM 51 ISO 3166-2:AM Asia Western Asia 142 145
Australia 0.8 AU AUS 36 ISO 3166-2:AU Oceania Australia and New Zealand 9 53
Austria 1 AT AUT 40 ISO 3166-2:AT Europe Western Europe 150 155
Bahamas 1.6 BS BHS 44 ISO 3166-2:BS Americas Caribbean 19 29
Bahrain 1.4 BH BHR 48 ISO 3166-2:BH Asia Western Asia 142 145
Bangladesh 1 BD BGD 50 ISO 3166-2:BD Asia Southern Asia 142 34
Barbados 0.86 BB BRB 52 ISO 3166-2:BB Americas Caribbean 19 29
Belarus 2.7 BY BLR 112 ISO 3166-2:BY Europe Eastern Europe 150 151
Belgium 1.1 BE BEL 56 ISO 3166-2:BE Europe Western Europe 150 155
Belize 0.6 BZ BLZ 84 ISO 3166-2:BZ Americas Central America 19 13
Benin 0.8 BJ BEN 204 ISO 3166-2:BJ Africa Western Africa 2 11
Bermuda 0.2 BM BMU 60 ISO 3166-2:BM Americas Northern America 19 21
Bhutan 1.4 BT BTN 64 ISO 3166-2:BT Asia Southern Asia 142 34
Bolivia 4.7 BO BOL 68 ISO 3166-2:BO Americas South America 19 5
Bosnia and Herzegovina 4.8 BA BIH 70 ISO 3166-2:BA Europe Southern Europe 150 39
Botswana 0.5 BW BWA 72 ISO 3166-2:BW Africa Southern Africa 2 18
Brazil 2.8 BR BRA 76 ISO 3166-2:BR Americas South America 19 5
Brunei 4.8 BN BRN 96 ISO 3166-2:BN Asia South-Eastern Asia 142 35
Bulgaria 4.4 BG BGR 100 ISO 3166-2:BG Europe Eastern Europe 150 151
Burkina Faso 0.7 BF BFA 854 ISO 3166-2:BF Africa Western Africa 2 11
Burundi 1 BI BDI 108 ISO 3166-2:BI Africa Eastern Africa 2 14
Cambodia 2.3 KH KHM 116 ISO 3166-2:KH Asia South-Eastern Asia 142 35
Cameroon 1.5 CM CMR 120 ISO 3166-2:CM Africa Middle Africa 2 17
Canada 2.1 CA CAN 124 ISO 3166-2:CA Americas Northern America 19 21
Cape Verde 2.8 CV CPV 132 ISO 3166-2:CV Africa Western Africa 2 11
Cayman Islands 0.9 KY CYM 136 ISO 3166-2:KY Americas Caribbean 19 29
Central African Rep. 4.1 CF CAF 140 ISO 3166-2:CF Africa Middle Africa 2 17
Chile 3.4 CL CHL 152 ISO 3166-2:CL Americas South America 19 5
China 1.03 CN CHN 156 ISO 3166-2:CN Asia Eastern Asia 142 30
Colombia 2.3 CO COL 170 ISO 3166-2:CO Americas South America 19 5
Congo, Dem. Rep. 0.75 CD COD 180 ISO 3166-2:CD Africa Middle Africa 2 17
Cook Islands 1.3 CK COK 184 ISO 3166-2:CK Oceania Polynesia 9 61
Costa Rica 2.3 CR CRI 188 ISO 3166-2:CR Americas Central America 19 13
Cote D'Ivoire 1.8 CI CIV 384 ISO 3166-2:CI Africa Western Africa 2 11
Croatia 3.5 HR HRV 191 ISO 3166-2:HR Europe Southern Europe 150 39
Cuba 1.4 CU CUB 192 ISO 3166-2:CU Americas Caribbean 19 29
Cyprus 1.14 CY CYP 196 ISO 3166-2:CY Asia Western Asia 142 145
Czech Rep. 2.5 CZ CZE 203 ISO 3166-2:CZ Europe Eastern Europe 150 151
Denmark 0.8 DK DNK 208 ISO 3166-2:DK Europe Northern Europe 150 154
Djibouti 0.9 DJ DJI 262 ISO 3166-2:DJ Africa Eastern Africa 2 14
Dominica 2 DM DMA 212 ISO 3166-2:DM Americas Caribbean 19 29
Dominican Rep. 4.4 DO DOM 214 ISO 3166-2:DO Americas Caribbean 19 29
Ecuador 3 EC ECU 218 ISO 3166-2:EC Americas South America 19 5
Egypt 1.18 EG EGY 818 ISO 3166-2:EG Africa Northern Africa 2 15
El Salvador 1.4 SV SLV 222 ISO 3166-2:SV Americas Central America 19 13
Estonia 2.7 EE EST 233 ISO 3166-2:EE Europe Northern Europe 150 154
Ethiopia 1.55 ET ETH 231 ISO 3166-2:ET Africa Eastern Africa 2 14
Fiji 1.5 FJ FJI 242 ISO 3166-2:FJ Oceania Melanesia 9 54
Finland 1.2 FI FIN 246 ISO 3166-2:FI Europe Northern Europe 150 154
France 1.2 FR FRA 250 ISO 3166-2:FR Europe Western Europe 150 155
French Polynesia 3.2 PF PYF 258 ISO 3166-2:PF Oceania Polynesia 9 61
Gabon 4.4 GA GAB 266 ISO 3166-2:GA Africa Middle Africa 2 17
Gambia 2.3 GM GMB 270 ISO 3166-2:GM Africa Western Africa 2 11
Georgia 2.4 GE GEO 268 ISO 3166-2:GE Asia Western Asia 142 145
Germany 0.7 DE DEU 276 ISO 3166-2:DE Europe Western Europe 150 155
Ghana 0.4 GH GHA 288 ISO 3166-2:GH Africa Western Africa 2 11
Gibraltar 1.6 GI GIB 292 ISO 3166-2:GI Europe Southern Europe 150 39
Greece 2.2 GR GRC 300 ISO 3166-2:GR Europe Southern Europe 150 39
Grenada 2.2 GD GRD 308 ISO 3166-2:GD Americas Caribbean 19 29
Guatemala 5.2 GT GTM 320 ISO 3166-2:GT Americas Central America 19 13
Guinea-Bissau 0.5 GW GNB 624 ISO 3166-2:GW Africa Western Africa 2 11
Guyana 1.3 GY GUY 328 ISO 3166-2:GY Americas South America 19 5
Haiti 0.65 HT HTI 332 ISO 3166-2:HT Americas Caribbean 19 29
Honduras 3.7 HN HND 340 ISO 3166-2:HN Americas Central America 19 13
Hong Kong, China 0.8 HK HKG 344 ISO 3166-2:HK Asia Eastern Asia 142 30
Hungary 3.3 HU HUN 348 ISO 3166-2:HU Europe Eastern Europe 150 151
Iceland 1.4 IS ISL 352 ISO 3166-2:IS Europe Northern Europe 150 154
India 3.94 IN IND 356 ISO 3166-2:IN Asia Southern Asia 142 34
Indonesia 2.2 ID IDN 360 ISO 3166-2:ID Asia South-Eastern Asia 142 35
Iran 1.15 IR IRN 364 ISO 3166-2:IR Asia Southern Asia 142 34
Iraq 1.7 IQ IRQ 368 ISO 3166-2:IQ Asia Western Asia 142 145
Ireland 1.1 IE IRL 372 ISO 3166-2:IE Europe Northern Europe 150 154
Israel 1.66 IL ISR 376 ISO 3166-2:IL Asia Western Asia 142 145
Italy 1.1 IT ITA 380 ISO 3166-2:IT Europe Southern Europe 150 39
Jamaica 1.1 JM JAM 388 ISO 3166-2:JM Americas Caribbean 19 29
Japan 1.7 JP JPN 392 ISO 3166-2:JP Asia Eastern Asia 142 30
Jordan 3.3 JO JOR 400 ISO 3166-2:JO Asia Western Asia 142 145
Kazakhstan 2.1 KZ KAZ 398 ISO 3166-2:KZ Asia Central Asia 142 143
Kenya 1.35 KE KEN 404 ISO 3166-2:KE Africa Eastern Africa 2 14
Kiribati 1 KI KIR 296 ISO 3166-2:KI Oceania Micronesia 9 57
Korea, Dem. Rep. 3 KP PRK 408 ISO 3166-2:KP Asia Eastern Asia 142 30
Korea, Rep. 3.1 KR KOR 410 ISO 3166-2:KR Asia Eastern Asia 142 30
Kuwait 2.6 KW KWT 414 ISO 3166-2:KW Asia Western Asia 142 145
Kyrgyzstan 3.1 KG KGZ 417 ISO 3166-2:KG Asia Central Asia 142 143
Laos 2 LA LAO 418 ISO 3166-2:LA Asia South-Eastern Asia 142 35
Latvia 3.4 LV LVA 428 ISO 3166-2:LV Europe Northern Europe 150 154
Lebanon 3.4 LB LBN 422 ISO 3166-2:LB Asia Western Asia 142 145
Lesotho 0.4 LS LSO 426 ISO 3166-2:LS Africa Southern Africa 2 18
Liberia 0.4 LR LBR 430 ISO 3166-2:LR Africa Western Africa 2 11
Libya 1.14 LY LBY 434 ISO 3166-2:LY Africa Northern Africa 2 15
Liechtenstein 3.4 LI LIE 438 ISO 3166-2:LI Europe Western Europe 150 155
Lithuania 3.6 LT LTU 440 ISO 3166-2:LT Europe Northern Europe 150 154
Luxembourg 3 LU LUX 442 ISO 3166-2:LU Europe Western Europe 150 155
Macao, China 1.8 MO MAC 446 ISO 3166-2:MO Asia Eastern Asia 142 30
Macedonia, FYR 3.03 MK MKD 807 ISO 3166-2:MK Europe Southern Europe 150 39
Madagascar 3.1 MG MDG 450 ISO 3166-2:MG Africa Eastern Africa 2 14
Malawi 0.7 MW MWI 454 ISO 3166-2:MW Africa Eastern Africa 2 14
Malaysia 1.6 MY MYS 458 ISO 3166-2:MY Asia South-Eastern Asia 142 35
Maldives 2.1 MV MDV 462 ISO 3166-2:MV Asia Southern Asia 142 34
Mali 2.2 ML MLI 466 ISO 3166-2:ML Africa Western Africa 2 11
Malta 1.6 MT MLT 470 ISO 3166-2:MT Europe Southern Europe 150 39
Martinique 6.3 MQ MTQ 474 ISO 3166-2:MQ Americas Caribbean 19 29
Mauritania 2 MR MRT 478 ISO 3166-2:MR Africa Western Africa 2 11
Mauritius 4.9 MU MUS 480 ISO 3166-2:MU Africa Eastern Africa 2 14
Mexico 2 MX MEX 484 ISO 3166-2:MX Americas Central America 19 13
Micronesia, Fed. Sts. 2.1 FM FSM 583 ISO 3166-2:FM Oceania Micronesia 9 57
Moldova 2.3 MD MDA 498 ISO 3166-2:MD Europe Eastern Europe 150 151
Mongolia 1.9 MN MNG 496 ISO 3166-2:MN Asia Eastern Asia 142 30
Morocco 2.5 MA MAR 504 ISO 3166-2:MA Africa Northern Africa 2 15
Mozambique 3.05 MZ MOZ 508 ISO 3166-2:MZ Africa Eastern Africa 2 14
Myanmar 1.1 MM MMR 104 ISO 3166-2:MM Asia South-Eastern Asia 142 35
Namibia 1.2 NA NAM 516 ISO 3166-2:NA Africa Southern Africa 2 18
Nepal 0.5 NP NPL 524 ISO 3166-2:NP Asia Southern Asia 142 34
Netherlands 0.8 NL NLD 528 ISO 3166-2:NL Europe Western Europe 150 155
New Caledonia 4.4 NC NCL 540 ISO 3166-2:NC Oceania Melanesia 9 54
New Zealand 1.6 NZ NZL 554 ISO 3166-2:NZ Oceania Australia and New Zealand 9 53
Nicaragua 1.5 NI NIC 558 ISO 3166-2:NI Americas Central America 19 13
Niger 1.3 NE NER 562 ISO 3166-2:NE Africa Western Africa 2 11
Nigeria 0.46 NG NGA 566 ISO 3166-2:NG Africa Western Africa 2 11
Niue 1.8 NU NIU 570 ISO 3166-2:NU Oceania Polynesia 9 61
Norway 1.7 NO NOR 578 ISO 3166-2:NO Europe Northern Europe 150 154
Oman 1.65 OM OMN 512 ISO 3166-2:OM Asia Western Asia 142 145
Pakistan 1.38 PK PAK 586 ISO 3166-2:PK Asia Southern Asia 142 34
Panama 3.6 PA PAN 591 ISO 3166-2:PA Americas Central America 19 13
Papua New Guinea 1.7 PG PNG 598 ISO 3166-2:PG Oceania Melanesia 9 54
Paraguay 3.8 PY PRY 600 ISO 3166-2:PY Americas South America 19 5
Peru 2.9 PE PER 604 ISO 3166-2:PE Americas South America 19 5
Philippines 2.9 PH PHL 608 ISO 3166-2:PH Asia South-Eastern Asia 142 35
Poland 3.2 PL POL 616 ISO 3166-2:PL Europe Eastern Europe 150 151
Portugal 1.5 PT PRT 620 ISO 3166-2:PT Europe Southern Europe 150 39
Puerto Rico 3.8 PR PRI 630 ISO 3166-2:PR Americas Caribbean 19 29
Reunion 4.1 RE REU 638 ISO 3166-2:RE Africa Eastern Africa 2 14
Romania 2.8 RO ROU 642 ISO 3166-2:RO Europe Eastern Europe 150 151
Russia 2.9 RU RUS 643 ISO 3166-2:RU Europe Eastern Europe 150 151
Rwanda 0.3 RW RWA 646 ISO 3166-2:RW Africa Eastern Africa 2 14
Saint Kitts and Nevis 5.5 KN KNA 659 ISO 3166-2:KN Americas Caribbean 19 29
Saint Lucia 6 LC LCA 662 ISO 3166-2:LC Americas Caribbean 19 29
Saint Vincent and the Grenadines 3.2 VC VCT 670 ISO 3166-2:VC Americas Caribbean 19 29
Samoa 2.5 WS WSM 882 ISO 3166-2:WS Oceania Polynesia 9 61
San Marino 3.7 SM SMR 674 ISO 3166-2:SM Europe Southern Europe 150 39
Saudi Arabia 5.9 SA SAU 682 ISO 3166-2:SA Asia Western Asia 142 145
Senegal 1.2 SN SEN 686 ISO 3166-2:SN Africa Western Africa 2 11
Serbia and Montenegro 5.35 NA NA NA NA Europe Southern Europe 150 039
Seychelles 1.5 SC SYC 690 ISO 3166-2:SC Africa Eastern Africa 2 14
Sierra Leone 1.3 SL SLE 694 ISO 3166-2:SL Africa Western Africa 2 11
Singapore 1 SG SGP 702 ISO 3166-2:SG Asia South-Eastern Asia 142 35
Slovak republic 4.3 SK SVK 703 ISO 3166-2:SK Europe Eastern Europe 150 151
Slovenia 1.8 SI SVN 705 ISO 3166-2:SI Europe Southern Europe 150 39
Solomon Islands 2.7 SB SLB 90 ISO 3166-2:SB Oceania Melanesia 9 54
Somalia 1 SO SOM 706 ISO 3166-2:SO Africa Eastern Africa 2 14
South Africa 1.05 ZA ZAF 710 ISO 3166-2:ZA Africa Southern Africa 2 18
Spain 1.12 ES ESP 724 ISO 3166-2:ES Europe Southern Europe 150 39
Sri Lanka 1.4 LK LKA 144 ISO 3166-2:LK Asia Southern Asia 142 34
Sudan 1.4 SD SDN 729 ISO 3166-2:SD Africa Northern Africa 2 15
Suriname 1.9 SR SUR 740 ISO 3166-2:SR Americas South America 19 5
Swaziland 0.9 SZ SWZ 748 ISO 3166-2:SZ Africa Southern Africa 2 18
Sweden 1 SE SWE 752 ISO 3166-2:SE Europe Northern Europe 150 154
Switzerland 0.86 CH CHE 756 ISO 3166-2:CH Europe Western Europe 150 155
Syria 2.3 SY SYR 760 ISO 3166-2:SY Asia Western Asia 142 145
Tajikistan 1.2 TJ TJK 762 ISO 3166-2:TJ Asia Central Asia 142 143
Tanzania 0.3 TZ TZA 834 ISO 3166-2:TZ Africa Eastern Africa 2 14
Thailand 1.6 TH THA 764 ISO 3166-2:TH Asia South-Eastern Asia 142 35
Togo 0.3 TG TGO 768 ISO 3166-2:TG Africa Western Africa 2 11
Tokelau 4.8 TK TKL 772 ISO 3166-2:TK Oceania Polynesia 9 61
Tonga 3.1 TO TON 776 ISO 3166-2:TO Oceania Polynesia 9 61
Trinidad and Tobago 0.6 TT TTO 780 ISO 3166-2:TT Americas Caribbean 19 29
Tunisia 1.3 TN TUN 788 ISO 3166-2:TN Africa Northern Africa 2 15
Turkey 2.7 TR TUR 792 ISO 3166-2:TR Asia Western Asia 142 145
Turkmenistan 2.6 TM TKM 795 ISO 3166-2:TM Asia Central Asia 142 143
Tuvalu 2 TV TUV 798 ISO 3166-2:TV Oceania Polynesia 9 61
Uganda 0.9 UG UGA 800 ISO 3166-2:UG Africa Eastern Africa 2 14
Ukraine 4.4 UA UKR 804 ISO 3166-2:UA Europe Eastern Europe 150 151
United Arab Emirates 1.6 AE ARE 784 ISO 3166-2:AE Asia Western Asia 142 145
United Kingdom 0.7 GB GBR 826 ISO 3166-2:GB Europe Northern Europe 150 154
United States 1.19 US USA 840 ISO 3166-2:US Americas Northern America 19 21
Uruguay 2.5 UY URY 858 ISO 3166-2:UY Americas South America 19 5
Uzbekistan 1.4 UZ UZB 860 ISO 3166-2:UZ Asia Central Asia 142 143
Vanuatu 1.2 VU VUT 548 ISO 3166-2:VU Oceania Melanesia 9 54
Venezuela 2.1 VE VEN 862 ISO 3166-2:VE Americas South America 19 5
Vietnam 1.9 VN VNM 704 ISO 3166-2:VN Asia South-Eastern Asia 142 35
Yemen, Rep. 3.1 YE YEM 887 ISO 3166-2:YE Asia Western Asia 142 145
Zambia 2.3 ZM ZMB 894 ISO 3166-2:ZM Africa Eastern Africa 2 14
Zimbabwe 1.3 ZW ZWE 716 ISO 3166-2:ZW Africa Eastern Africa 2 14
## JOIN GAPMINDER TEETH DATA:
datafile <- "https://gist.githubusercontent.com/csiu/fd8904ab6d451136d90d/raw/321ef860e1f6be2e43329ecc9e96a7bd27aac0da/indicator-who-bad_teeth.tsv"
dat <- read.delim(datafile)
## WITH COUNTRY INFORMATION FROM:
cfile <- "https://rawgit.com/lukes/ISO-3166-Countries-with-Regional-Codes/master/all/all.csv"
cdat <- read.delim(cfile, sep=",")
## BUT FIRST MAKE IT SO THAT COLUMNS MATCH
cdat$name <-
plyr::revalue(cdat$name, replace = c(
"Bolivia (Plurinational State of)" = "Bolivia",
"Brunei Darussalam" = "Brunei",
"Cabo Verde" = "Cape Verde",
"Central African Republic" = "Central African Rep.",
"Congo (Democratic Republic of the)" = "Congo, Dem. Rep.",
"Côte d'Ivoire" = "Cote D'Ivoire",
"Czech Republic" = "Czech Rep.",
"Dominican Republic" = "Dominican Rep.",
"Hong Kong" = "Hong Kong, China",
"Iran (Islamic Republic of)" = "Iran",
"Korea (Democratic People's Republic of)" = "Korea, Dem. Rep.",
"Korea (Republic of)" = "Korea, Rep.",
"Lao People's Democratic Republic" = "Laos",
"Macao" = "Macao, China",
"Macedonia (the former Yugoslav Republic of)" = "Macedonia, FYR",
"Micronesia (Federated States of)" = "Micronesia, Fed. Sts.",
"Moldova (Republic of)" = "Moldova",
"Réunion" = "Reunion",
"Russian Federation" = "Russia",
## "Serbia and Montenegro",
"Slovakia" = "Slovak republic",
"Syrian Arab Republic" = "Syria",
"Tanzania, United Republic of" = "Tanzania",
"United Kingdom of Great Britain and Northern Ireland" = "United Kingdom",
"United States of America" = "United States",
"Venezuela (Bolivarian Republic of)" = "Venezuela",
"Viet Nam" = "Vietnam",
"Yemen" = "Yemen, Rep."
))
## JOIN
dat2 <- left_join(dat, cdat, by = c("country" = "name"))
## POST-PROCESS
dat2[dat2$country == "Serbia and Montenegro",7:10] <-
c("Europe", "Southern Europe", "150", "039")
# write.table(dat2, file="indicator-who-bad_teeth-regions.tsv", sep="\t", quote=FALSE, row.names=FALSE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment