-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata_analysis.R
103 lines (96 loc) · 7.06 KB
/
data_analysis.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
library(readr)
tab3data <- read_tsv(col_names = FALSE, '
Albania 2,900,000 34.20 11,840 1,248,266 27,398 105 57,616 3.10 1122910 27.94 20.2 4.64 0.785 774 -
Armenia 3,000,000 25.80 8,621 914,796 28,203 103 191,199 10.60 937299 23.70 25.7 4.29 0.755 883 89.77
Bahamas 400,000 9.00 24,555 899,101 10,010 39 59,306 16.30 40095 9.35 - - 0.807 1699 -
Bahrain 1,300,000 66.90 50,704 88,026,316 760 1936 704,137 54.70 55964 4.00 - 6.23 0.846 2453 616.5
Barbados 300,000 4.80 17,100 11,162,791 430 664 34,475 11.30 98464 26.16 - - 0.800 1234 1013.0
Belize 400,000 3.10 8,220 135,929 22,806 16 53,860 15.00 59884 14.29 33.8 - 0.708 524 313.7
Bhutan 800,000 6.50 8,227 169,297 38,394 21 51,106 6.70 44190 5.40 28.6 - 0.612 287 147.9
Bosnia and Herzegovina 3,900,000 42.20 10,958 824,428 51,187 68 34,803 0.60 1650772 30.23 25.3 5.09 0.768 1102 227.6
Botswana 2,200,000 36.70 17,042 64,757 566,730 4 160,644 7.20 58346 2.51 16.6 3.50 0.717 970 -
Brunei Darussalam 400,000 32.50 76,884 6,172,840 5,265 81 102,733 49.30 46237 9.85 - - 0.853 2083 1392.6
Cabo Verde 500,000 3.50 6,662 867,840 4,033 136 14,924 3.00 165732 24.00 - - 0.654 310 175.2
Central African Republic 4,900,000 3.20 652 5,137 622,984 7 81,598 2.90 440745 8.17 - 3.48 0.367 32 -
Comoros 800,000 1.30 1,529 581,655 2,235 437 12,555 1.70 116516 12.74 23.1 - 0.752 121 41.5
Congo, Republic of 4,500,000 29.80 6,676 87,262 341,500 15 392,996 9.70 220501 4.56 18.8 4.88 0.606 203 -
Costa Rica 4,900,000 80.70 16,436 1,580,494 51,060 96 421,697 8.70 133185 2.70 44.7 7.23 0.794 1286 729.2
Croatia 4,200,000 95.10 22,795 1,699,003 55,974 74 576,883 17.60 865147 16.95 30.2 5.34 0.831 1656 -
Cyprus 800,000 29.70 34,970 3,213,938 9,241 128 196,167 18.20 177185 13.20 30.7 6.06 0.869 2137 -
Djibouti 1,000,000 3.30 3,370 142,364 23,180 41 112,351 14.20 15927 1.76 16.4 - 0.476 147 -
Dominica 100,000 0.80 11,375 1,065,246 751 99 6,720 8.90 69817 49.11 - - 0.715 586 -
Equatorial Guinea 800,000 31.70 38,639 1,130,084 28,051 45 10,825 1.30 81029 8.75 - - 0.591 790 -
Estonia 1,300,000 38.50 29,313 908,276 42,388 31 202,348 16.40 198042 13.11 17.9 5.94 0.871 1887 -
Eswatini 1,100,000 11.10 9,776 645,199 17,204 79 31,579 2.00 95671 6.92 15.5 - 0.588 - -
Fiji 900,000 8.30 9,268 454,197 18,274 50 13,751 2.50 204934 18.65 - - 0.741 331 -
Gabon 1,900,000 35.90 19,057 139,327 257,667 8 268,384 23.60 63209 3.53 17.5 4.78 0.702 481 -
Gambia 2,100,000 3.40 1,667 335,968 10,120 208 192,540 8.80 89639 4.31 - - 0.460 - -
Georgia 3,700,000 37.20 10,044 533,716 69,700 65 168,802 4.40 838430 17.33 31.1 4.45 0.780 718 -
Guinea-Bissau 1,700,000 2.90 1,730 103,129 28,120 66 22,333 1.10 101828 5.67 - - 0.455 100 -
Guyana 800,000 6.00 7,873 30,480 196,849 4 15,384 1.70 460286 37.03 - - 0.654 336 -
Iceland 300,000 16.50 49,136 164,589 100,250 3 37,522 10.70 38496 10.46 31.1 7.48 0.935 4116 -
Ireland 4,700,000 324.90 69,231 4,716,694 68,883 70 746,260 15.90 882022 15.83 30.0 7.06 0.938 5335 -
Jamaica 2,800,000 25.40 8,976 2,345,120 10,831 267 23,167 1.30 1067455 27.61 36.9 5.89 0.732 511 292.4
Kiribati 100,000 0.20 1,823 246,609 811 144 3,153 2.60 4717 4.33 - - 0.612 152 -
Kosovo 1,900,000 18.40 9,600 1,690,089 10,887 168 - - - - - 6.15 - - -
Kuwait 4,200,000 303.70 71,887 17,044,562 17,818 232 2,866,136 70.00 187871 4.20 - 6.09 0.803 2978 -
Latvia 2,000,000 50.60 25,710 812,864 62,249 31 263,126 13.80 337678 14.63 17.1 6.09 0.847 1429 828.1
Lebanon 4,600,000 85.20 18,525 8,328,446 10,230 595 1,997,776 33.30 798140 11.96 21.9 5.15 0.757 1117 -
Lesotho 1,900,000 7.00 3,601 230,605 30,355 74 6,572 0.10 363763 14.56 16.7 - 0.520 251 -
Liberia 4,400,000 3.80 855 39,452 96,320 49 113,779 5.30 276630 5.79 22.2 4.42 0.435 128 -
Lithuania 2,900,000 86.10 29,972 1,373,644 62,680 45 136,036 4.90 544120 15.90 21.0 6.27 0.858 1875 742.1
Luxembourg 600,000 59.90 104,003 23,163,186 2,586 231 249,325 43.30 61058 9.72 13.2 7.06 0.904 6382 4762.3
Macedonia 2,100,000 30.30 14,597 1,191,366 25,433 83 130,730 6.60 516024 19.89 23.4 5.23 - 857 -
Maldives 400,000 5.50 15,553 18,456,376 298 1454 94,086 24.40 2844 0.82 - - 0.717 1514 314.3
Malta 400,000 17.30 39,834 54,746,835 316 1454 41,442 8.00 103392 18.83 29.0 6.68 0.878 3471 1874.2
Mauritania 3,800,000 16.40 4,328 15,912 1,030,700 4 138,162 2.30 119334 2.85 18.0 4.68 0.520 177 -
Mauritius 1,300,000 25.90 20,422 12,758,621 2,030 623 28,585 3.60 168255 11.77 27.4 6.17 0.790 1099 499.3
Micronesia 100,000 0.30 3,234 427,350 702 151 2,756 2.60 19798 15.72 - - 0.627 458 -
Moldova 3,600,000 18.90 5,328 574,625 32,891 124 142,904 11.20 888610 17.92 - 5.33 0.700 515 167.6
Mongolia 3,000,000 37.00 12,275 23,816 1,553,556 2 17,620 0.60 59266 1.96 14.3 5.33 0.741 470 197.2
Montenegro 600,000 10.40 16,643 773,119 13,452 46 82,541 8.20 138356 18.11 25.1 5.61 0.814 957 -
Namibia 2,300,000 26.00 11,290 31,581 823,290 3 93,888 2.20 145852 5.60 21.6 4.44 0.647 942 -
New Zealand 4,700,000 177.00 37,294 669,094 264,537 18 1,039,736 25.10 802335 15.00 31.3 7.33 0.917 3530 2831.9
Oman 4,000,000 184.80 46,698 597,092 309,500 15 1,844,978 30.60 21333 0.27 21.1 - 0.821 1636 -
Panama 4,000,000 92.90 23,024 1,249,664 74,340 55 184,710 4.70 142706 3.50 39.5 6.57 0.789 1543 -
Qatar 2,600,000 329.20 127,660 28,413,603 11,586 227 1,687,640 73.80 25681 0.69 - - 0.856 3900 3131.3
Saint Lucia 200,000 2.10 11,783 3,465,347 606 293 12,771 6.70 55414 23.18 - - 0.747 681 381.4
Saint Vincent and the Grenadines 100,000 1.20 11,271 3,084,833 389 282 4,577 9.40 60424 36.97 - - 0.723 470 -
Samoa 200,000 1.10 5,553 389,933 2,821 69 4,929 3.00 113139 36.68 - - 0.713 336 -
São Tomé and Príncipe 200,000 0.60 3,072 622,407 964 213 2,394 3.30 35833 15.83 - - 0.589 308 68.4
Seychelles 100,000 2.60 27,602 5,714,286 455 208 12,791 13.00 11772 11.34 - - 0.797 867 -
Slovenia 2,100,000 66.20 32,085 3,285,197 20,151 103 235,966 11.30 140490 6.36 24.6 6.17 0.896 2734 1281.4
Solomon Islands 600,000 1.20 1,973 42,879 27,986 22 2,585 1.40 3833 0.65 - - 0.546 173 -
Suriname 600,000 7.90 13,988 50,641 156,000 4 46,836 7.50 267800 30.38 25.4 - 0.720 1017 -
Timor-Leste 1,200,000 5.00 4,187 336,157 14,874 87 10,834 1.00 37311 3.01 - - 0.625 141 -
Tonga 100,000 0.60 5,387 836,820 717 150 5,731 4.80 56524 35.42 - - 0.726 324 -
Trinidad and Tobago 1,400,000 43.60 31,870 8,502,340 5,128 267 49,883 2.40 363332 20.89 15.7 6.19 0.784 2204 -
Uruguay 3,500,000 74.90 21,527 427,963 175,015 20 71,799 2.30 346976 9.18 36.1 6.34 0.804 1748 -
Vanuatu 300,000 0.70 2,631 57,429 12,189 23 3,187 1.30 8583 3.40 40.6 - 0.603 106 2.6
')
colnames(tab3data) <- c(
"Country",
"Population",
"GDP (billions)",
"GDP (per capita)",
"GDP (per km2)",
"Land Area (km2)",
"Population Density (per km2)",
"Foreign Born Population",
"Foreign Born Population (percent)",
"Population Living Abroad",
"Population Living Abroad (percent)",
"Happy Planet Index",
"World Happiness Report Score",
"Human Development Index",
"Health Expenditure",
"Education Expenditure"
)
for (i in seq_along(tab3data)) {
if (i == 1)
next
tab3data[[i]] <- as.numeric(gsub("(,|-)", "", x = tab3data[[i]]))
}
dplyr::glimpse(tab3data)
## Write clean data as csv
readr::write_csv(tab3data, "data/small-countries.csv")