Skip to content

Instantly share code, notes, and snippets.

@cpsievert
Last active November 3, 2016 17:58
Show Gist options
  • Save cpsievert/d4a4ccb7ce61e2cfaecf9736de4f67fa to your computer and use it in GitHub Desktop.
Save cpsievert/d4a4ccb7ce61e2cfaecf9736de4f67fa to your computer and use it in GitHub Desktop.
Countries by area
"country" "area"
"Russia" 17098246
"Canada" 9984670
"China" 9572900
"United States" 9525067
"Brazil" 8515767
"Australia" 7692024
"India" 3287263
"Argentina" 2780400
"Kazakhstan" 2724900
"Algeria" 2381740
"Congo, Dem. Rep." 2345410
"Kingdom of Denmark" 2210583
"Denmark" 43098
"Faroe Islands" 1399
"Greenland" 2166086
"Saudi Arabia" 2149690
"Mexico" 1964375
"Indonesia" 1904556
"Sudan" 1861484
"Libya" 1759540
"Iran" 1648000
"Mongolia" 1565000
"Peru" 1285220
"Chad" 1284000
"Niger" 1267000
"Angola" 1246700
"Mali" 1240000
"South Africa" 1219912
"Colombia" 1197411
"Ethiopia" 1127127
"Bolivia" 1098580
"Mauritania" 1030700
"Egypt" 1001450
"Tanzania" 945087
"Nigeria" 923768
"Venezuela" 912050
"Namibia" 825418
"Pakistan" 803940
"Mozambique" 801590
"Turkey" 780580
"Chile" 756950
"Zambia" 752614
"Myanmar" 678500
"France" 675417
"Afghanistan" 647500
"Somalia" 637657
"Central African Republic" 622984
"South Sudan" 619745
"Ukraine" 603628
"Botswana" 600370
"Madagascar" 587040
"Kenya" 580367
"Yemen" 527970
"Thailand" 514000
"Spain" 504781
"Turkmenistan" 488100
"Cameroon" 475440
"Papua New Guinea" 462840
"Sweden" 449964
"Uzbekistan" 447400
"Morocco" 446550
"Iraq" 437072
"Paraguay" 406750
"Zimbabwe" 390580
"Japan" 377835
"Germany" 357021
"Congo, Rep." 342000
"Finland" 337030
"Malaysia" 329750
"Vietnam" 329560
"Norway" 324220
"Ivory Coast" 322460
"Poland" 312685
"Oman" 309500
"Italy" 301230
"Philippines" 3e+05
"Ecuador" 283560
"Burkina Faso" 274200
"New Zealand" 269190
"Gabon" 267667
"Guinea" 245857
"United Kingdom" 243610
"Uganda" 241550
"Ghana" 238540
"Romania" 238391
"Laos" 236800
"Guyana" 214970
"Belarus" 207600
"Kyrgyzstan" 198500
"Senegal" 196190
"Syria" 185180
"Cambodia" 181035
"Uruguay" 176220
"Tunisia" 163610
"Suriname" 163270
"Bangladesh" 147570
"Nepal" 147181
"Tajikistan" 143100
"Greece" 131940
"Nicaragua" 129494
"Eritrea" 121320
"Korea, Dem. Rep." 120540
"Malawi" 118480
"Benin" 112620
"Honduras" 112090
"Liberia" 111370
"Bulgaria" 110910
"Cuba" 109886
"Guatemala" 108890
"Iceland" 103000
"Korea, Rep." 98480
"Hungary" 93030
"Jordan" 92300
"Portugal" 88267
"Azores Islands" 2247
"Total" 91188
"Serbia" 88361
"Azerbaijan" 86600
"Austria" 83858
"United Arab Emirates" 82880
"Czech Republic" 78867
"Panama" 78201
"Sierra Leone" 72740
"Ireland" 71273
"Georgia" 69701
"Sri Lanka" 65611
"Lithuania" 65201
"Latvia" 64589
"Togo" 56785
"Croatia" 56542
"Bosnia and Herzegovina" 51129
"Costa Rica" 51100
"Slovakia" 48845
"Dominican Republic" 48730
"Bhutan" 47000
"Estonia" 45339
"Netherlands" 41526
"Aruba" 193
"Netherlands Antilles" 960
"Total" 42679
"Switzerland" 41210
"Guinea-Bissau" 36120
"Republic of China (Taiwan, Quemoy, Matsu)" 35980
"Moldova" 33843
"Belgium" 32545
"Lesotho" 30355
"Armenia" 29800
"Albania" 28748
"Solomon Islands" 28450
"Equatorial Guinea" 28051
"Burundi" 27834
"Haiti" 27750
"Israel (Including West Bank and Gaza)" 26990
"Rwanda" 26338
"Macedonia" 25333
"Belize" 22966
"Djibouti" 22000
"El Salvador" 21040
"Slovenia" 20253
"Fiji" 18270
"Kuwait" 17820
"Swaziland" 17363
"East Timor" 14874
"Bahamas" 13940
"Montenegro" 13812
"Vanuatu" 12200
"Qatar" 11437
"The Gambia" 11300
"Jamaica" 10990
"Kosovo" 10908
"Lebanon" 10452
"Cyprus" 9250
"Brunei" 5770
"Trinidad and Tobago" 5128
"Cape Verde" 4033
"Samoa" 2860
"Luxembourg" 2586
"Comoros" 2170
"Mauritius" 1860
"São Tomé and Príncipe" 1001
"Dominica" 754
"Tonga" 748
"Kiribati" 717
"Micronesia" 702
"Singapore" 692.7
"Bahrain" 665
"Saint Lucia" 620
"Seychelles" 455
"Andorra" 468
"Palau" 458
"Antigua and Barbuda" 442
"Barbados" 430
"Saint Vincent and the Grenadines" 389
"Grenada" 340
"Malta" 316
"Maldives" 300
"Saint Kitts and Nevis" 261
"Marshall Islands" 181
"Liechtenstein" 160
"San Marino" 61.2
"Tuvalu" 26
"Nauru" 21
"Monaco" 1.95
"Vatican City" 0.44
library(rvest)
src <- html("https://simple.wikipedia.org/wiki/List_of_countries_by_area")
tabs <- html_table(src)
countryArea <- tabs[[3]][, -1]
names(countryArea) <- c("country", "area")
countryArea$area <- as.numeric(gsub(",", "", countryArea$area))
countryArea$country <- sub("^Israel", "Israel", countryArea$country)
countryArea$country <- sub(
"Democratic Republic of the Congo", "Congo, Dem. Rep.", countryArea$country, fixed = T
)
countryArea$country <- sub(
"Republic of the Congo", "Congo, Rep.", countryArea$country, fixed = T
)
countryArea$country <- sub(
"Myanmar (Burma)", "Myanmar", countryArea$country, fixed = T
)
countryArea$country <- sub(
"North Korea", "Korea, Dem. Rep.", countryArea$country, fixed = T
)
countryArea$country <- sub(
"South Korea", "Korea, Rep.", countryArea$country, fixed = T
)
countryArea$country <- sub(
"United States of America", "United States", countryArea$country, fixed = T
)
# write.table(countryArea, "countryByArea.txt", row.names = FALSE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment