Project 2 - Unicef
https://sejdemyr.github.io/r-tutorials/basics/wide-and-long/ https://childmortality.org/data
For this analysis I used Alec Mcabe’s suggested data set1. Alec linked to a website article by Simon Ejdemyr about wide and long data sets2 using some sample data from the Unicef Child Mortality website3.
I decided to go directly to the Unicef website4 and pull my own data from it for analysis and tidying.
The data I grab was the mortality rates, defined as deaths out of 1000 births, for all countries that had data. The data was offered in different age ranges so I decided to get the mortality rate groupings from 1-59 months, 5-9 years, 10-14 years, 15-19 years, and 20-24 years. This resulted in a rather large, long data set due to the fact that there was data going back to the 1960s, each row in the data set represented one value, for one indicator (e.g. 1-59 months), for one country for one year.
As I tidied the data for analysis I became curious if I could compare how the moratility rate changes over time for the countries with the lowest and highest mortality rates. For example I was curious if countries with high mortality rates at young ages, continue to have high mortality rates and people get older. Similarily for countries with low mortality rates.
Setup
Load Libraries
library(stringr)
library(dplyr)##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(tidyr)
library(kableExtra)##
## Attaching package: 'kableExtra'
## The following object is masked from 'package:dplyr':
##
## group_rows
library(readr)
library(forcats)
library(ggplot2)Load Data
unicefUrl <- 'https://raw.githubusercontent.com/nolivercuny/data607/master/project2/datasets/childmortality/all_countries_dr_u5_5_9_10_14_15_24.csv'
unicefRaw <- read.csv(unicefUrl)Tidy
Grab only the relevant columns (Country, Sex, Year, Indicator, Value)
Rename them so they are easier to work with
Mutate “Year” so it’s a number and drop extra data from it
Get the last year of data for each observation to make it easier to analyze. I do this with group_by and slice_max on Year. Interestingly this reveals that many indicators do not have data separated by genders. Because of this I also decided to filter out the gender specific observations and just keep the totals.
The last step was to then make the data wider instead of longer so I could see how the mortality rate changed over time by country. I used the pivot_wider function to accomplish this. Unfortunately I discovered that some countries had multiple datasoruces for the Indicator per in a single year. I solved this by using the value_fn parameter and setting that to the mean. There are probably more nuanced ways of handling this but for my purposes this worked well enough in getting me a single value for the observation.
beforeColon <- "^(.*?): "
unicefDf <- as.data.frame(unicefRaw) %>%
select(c("REF_AREA.Geographic.area","INDICATOR.Indicator","SEX.Sex","TIME_PERIOD.Time.period","OBS_VALUE.Observation.Value" )) %>%
rename(Country = "REF_AREA.Geographic.area", Indicator = "INDICATOR.Indicator", Sex = "SEX.Sex", Year = "TIME_PERIOD.Time.period", Value = "OBS_VALUE.Observation.Value") %>%
mutate(Year = as.numeric(gsub("-.*", "", Year)), Sex = gsub(beforeColon, "", Sex),Country = gsub(beforeColon, "", Country),Indicator = gsub(beforeColon, "", Indicator)) %>%
filter(Sex == "Total") %>%
group_by(Country) %>%
slice_max(Year) %>%
pivot_wider(names_from = Indicator, values_from = Value, values_fn = mean) %>%
select(-Sex, -Year)Analysis
kable(unicefDf,caption = "Mortality rates (deaths / 1000 births) by Country for year of 2029", format = "html") %>% kable_styling("striped") %>% scroll_box(width = "100%")| Country | Mortality rate 1-59 months | Mortality rate age 10-14 | Mortality rate age 15-19 | Mortality rate age 20-24 | Mortality rate age 5-9 |
|---|---|---|---|---|---|
| Afghanistan | 25.3143636 | 1.9149162 | 13.5913814 | 17.580780 | 2.3892118 |
| Albania | 2.1779800 | 1.0568891 | 1.7234748 | 1.818202 | 0.8559891 |
| Algeria | 7.0880726 | 1.6741230 | 2.7255660 | 3.242422 | 1.6604642 |
| Andorra | 1.5437696 | 0.4425771 | 1.3494353 | 2.004404 | 0.3694054 |
| Angola | 48.4491406 | 6.1926755 | 12.7935640 | 19.444002 | 10.3332650 |
| Antigua and Barbuda | 2.9693223 | 0.9764516 | 2.4473407 | 3.166673 | 0.6936262 |
| Argentina | 3.1991424 | 1.0378119 | 3.4079363 | 4.860814 | 0.8033553 |
| Armenia | 5.4191078 | 0.9437659 | 2.0172190 | 2.350256 | 1.0021272 |
| Australia | 1.3289327 | 0.4198412 | 1.4727104 | 1.962517 | 0.3682458 |
| Austria | 1.4131134 | 0.4368958 | 1.2175817 | 1.598094 | 0.3283050 |
| Azerbaijan | 9.6478223 | 1.4454700 | 2.5525448 | 3.203226 | 1.6055182 |
| Bahamas | 5.8954484 | 1.4150651 | 4.7523351 | 12.636353 | 1.1037302 |
| Bahrain | 3.9748161 | 0.8324837 | 2.0030620 | 2.775621 | 0.9435139 |
| Bangladesh | 11.9165102 | 3.2980984 | 6.4537930 | 5.267299 | 3.5892914 |
| Barbados | 4.3212994 | 1.2005919 | 2.2912860 | 3.688842 | 0.5391762 |
| Belarus | 2.0184068 | 0.6499010 | 1.4660056 | 2.322225 | 0.5932075 |
| Belgium | 1.4068809 | 0.4156989 | 1.0417298 | 1.779556 | 0.3868668 |
| Belize | 4.2026186 | 1.5053202 | 3.9911346 | 7.397166 | 1.1983049 |
| Benin | 61.6102576 | 7.1536294 | 11.1796378 | 11.155139 | 12.5326828 |
| Bhutan | 12.1243309 | 4.7279587 | 5.4677138 | 6.756415 | 2.3924769 |
| Bolivia (Plurinational State of) | 11.5823152 | 1.8500313 | 4.6007493 | 5.264309 | 2.2701647 |
| Bosnia and Herzegovina | 1.6427326 | 0.6757114 | 1.6736974 | 2.541683 | 0.5205431 |
| Botswana | 24.1073666 | 2.2398811 | 3.8626327 | 11.370585 | 3.5843504 |
| Brazil | 6.1174099 | 1.3847007 | 5.7635455 | 7.854176 | 0.9732986 |
| Brunei Darussalam | 5.4571122 | 1.1193954 | 1.2599821 | 2.591499 | 1.2768704 |
| Bulgaria | 3.4148140 | 0.9181536 | 2.4233529 | 2.937142 | 0.7558998 |
| Burkina Faso | 63.2389410 | 6.3311260 | 6.0691511 | 9.976072 | 11.1309518 |
| Burundi | 36.2484504 | 9.4190958 | 8.7029496 | 8.924523 | 12.0167457 |
| Cabo Verde | 5.9324643 | 1.0626895 | 2.2965355 | 3.838575 | 0.8658293 |
| Cambodia | 12.2775510 | 1.7833339 | 3.5114033 | 4.677901 | 3.0311251 |
| Cameroon | 50.0271194 | 8.4192333 | 12.2545313 | 17.722721 | 14.3399342 |
| Canada | 1.5326708 | 0.5358731 | 1.7126237 | 2.911541 | 0.3643013 |
| Central African Republic | 73.2287311 | 5.1535227 | 11.2881333 | 23.648029 | 9.0512330 |
| Chad | 83.3010190 | 10.6415063 | 15.5254970 | 19.564061 | 15.2078485 |
| Chile | 2.4296133 | 0.7884823 | 2.0939249 | 2.919560 | 0.6207646 |
| China | 4.0545505 | 0.9620691 | 1.3463012 | 2.486957 | 0.9335982 |
| Colombia | 6.3160589 | 1.3868552 | 4.4855653 | 6.817416 | 1.0860383 |
| Comoros | 34.0883795 | 2.5501865 | 3.2990620 | 5.740678 | 5.8892405 |
| Congo | 29.0518672 | 3.8369481 | 5.3719470 | 11.015678 | 4.1191732 |
| Cook Islands | 3.5100496 | 1.0648691 | 5.8415379 | 3.601053 | 0.9788919 |
| Costa Rica | 2.4770903 | 0.9839317 | 2.8031549 | 4.905682 | 0.7295631 |
| Côte d’Ivoire | 47.8192313 | 10.5397721 | 11.0845702 | 15.484385 | 14.3072783 |
| Croatia | 1.8804079 | 0.5562643 | 1.3720212 | 2.005693 | 0.5029489 |
| Cuba | 2.9447939 | 1.0754401 | 2.0309504 | 2.755630 | 0.9374979 |
| Cyprus | 0.9819611 | 0.4080798 | 1.1525641 | 1.854223 | 0.4783974 |
| Czechia | 1.5495765 | 0.4628540 | 1.5485783 | 2.409537 | 0.4301735 |
| Democratic People’s Republic of Korea | 7.8715983 | 1.8672526 | 3.9942315 | 5.178676 | 2.0576873 |
| Democratic Republic of the Congo | 59.0032022 | 9.8671066 | 17.9944983 | 19.635172 | 12.3768163 |
| Denmark | 0.7640785 | 0.3034473 | 1.0216163 | 1.378119 | 0.3099458 |
| Djibouti | 27.8327352 | 5.0664345 | 10.7553736 | 16.501489 | 7.7789018 |
| Dominica | 6.7944071 | 1.7247323 | 1.8843225 | 4.126755 | 1.4937026 |
| Dominican Republic | 8.7813832 | 1.4293090 | 4.0951620 | 8.440866 | 1.2026652 |
| Ecuador | 6.9773970 | 1.8714295 | 3.7949947 | 6.454059 | 1.4249211 |
| Egypt | 9.2420617 | 2.0769845 | 3.4726361 | 3.883387 | 2.2634129 |
| El Salvador | 6.7690428 | 2.0921081 | 11.6781840 | 12.828955 | 1.1116222 |
| Equatorial Guinea | 54.4198981 | 6.5015216 | 10.8731180 | 14.198672 | 9.7848282 |
| Eritrea | 23.0801888 | 3.7665558 | 8.5242966 | 13.300727 | 3.7373871 |
| Estonia | 1.3348601 | 0.6198082 | 1.8390183 | 2.289101 | 0.5340208 |
| Eswatini | 31.5194837 | 3.3727443 | 10.0355724 | 15.388867 | 10.0766635 |
| Ethiopia | 23.7712743 | 4.8159788 | 8.0074376 | 8.575579 | 5.8646552 |
| Fiji | 15.0113268 | 2.7375189 | 3.6868872 | 6.268576 | 2.0390287 |
| Finland | 0.9935902 | 0.3967236 | 1.8510651 | 3.066747 | 0.2686926 |
| France | 1.8091052 | 0.3990456 | 1.1579032 | 2.031569 | 0.3421896 |
| Gabon | 22.6729760 | 6.9885222 | 7.0130929 | 8.154529 | 5.3875172 |
| Gambia | 25.2792683 | 4.6044798 | 8.1154234 | 10.779024 | 5.7498422 |
| Georgia | 4.7254047 | 1.2736340 | 2.8242662 | 4.207187 | 1.1445057 |
| Germany | 1.5361362 | 0.4124905 | 1.1115817 | 1.526758 | 0.3855450 |
| Ghana | 23.5769134 | 4.7323058 | 7.4224899 | 7.686792 | 5.9865131 |
| Greece | 1.4989437 | 0.4572024 | 1.1547295 | 1.850145 | 0.4193504 |
| Grenada | 5.5944063 | 2.0209264 | 2.5006069 | 3.348643 | 1.7902246 |
| Guatemala | 12.5054929 | 2.0540538 | 6.3367142 | 8.606126 | 1.6145938 |
| Guinea | 70.5790789 | 6.2295460 | 13.2900556 | 18.447630 | 12.6263053 |
| Guinea-Bissau | 44.9657381 | 3.5379854 | 10.5852844 | 13.765697 | 12.0377002 |
| Guyana | 10.8529046 | 2.8441292 | 5.7954016 | 11.434647 | 2.0237363 |
| Haiti | 38.4739993 | 4.5362396 | 6.8272688 | 11.713811 | 6.3458824 |
| Honduras | 7.7199774 | 2.5194035 | 3.9988705 | 6.017370 | 1.9166922 |
| Hungary | 1.6774963 | 0.5553997 | 1.4025348 | 1.985558 | 0.4032868 |
| Iceland | 0.9694852 | 0.2568733 | 1.4768768 | 1.422293 | 0.2181838 |
| India | 12.8937202 | 2.7006489 | 3.9622739 | 6.002941 | 2.7970701 |
| Indonesia | 11.6129351 | 1.9610076 | 4.7315381 | 5.367849 | 3.1822194 |
| Iran (Islamic Republic of) | 5.4040656 | 1.7682130 | 4.6922923 | 5.343087 | 1.6948478 |
| Iraq | 10.7422267 | 1.8054643 | 4.3174669 | 5.209195 | 1.9864992 |
| Ireland | 1.1776630 | 0.3227365 | 0.8419783 | 1.561325 | 0.2843018 |
| Israel | 1.7426474 | 0.4646563 | 1.2295725 | 1.532054 | 0.3455859 |
| Italy | 1.2206782 | 0.4795020 | 1.0715790 | 1.571127 | 0.3760860 |
| Jamaica | 4.0691287 | 1.4987528 | 3.6273369 | 5.501666 | 1.2337479 |
| Japan | 1.6204038 | 0.3934095 | 0.9362085 | 1.627421 | 0.3558018 |
| Jordan | 6.4541904 | 1.6513408 | 2.2661547 | 3.309070 | 1.7669367 |
| Kazakhstan | 5.8131569 | 1.4213946 | 2.9799976 | 4.373079 | 1.3568077 |
| Kenya | 22.5941621 | 4.5151610 | 6.3380522 | 9.746744 | 5.4082895 |
| Kiribati | 29.4204361 | 3.8576593 | 7.0970707 | 8.918926 | 5.4651220 |
| Kuwait | 3.4066875 | 0.9929709 | 2.0162887 | 4.141621 | 0.8553375 |
| Kyrgyzstan | 6.0855344 | 1.6620877 | 2.6766445 | 3.721185 | 1.2836336 |
| Lao People’s Democratic Republic | 24.0930411 | 4.7397141 | 4.6453852 | 7.444066 | 3.4319196 |
| Latvia | 1.7581188 | 0.6888684 | 2.4654841 | 3.608581 | 0.7009814 |
| Lebanon | 3.0698797 | 0.9633963 | 2.2949759 | 2.805123 | 0.8921717 |
| Lesotho | 45.5462695 | 3.5474475 | 10.2378400 | 17.645442 | 5.0806402 |
| Liberia | 53.9547698 | 7.4987860 | 18.4959879 | 10.387892 | 8.0954783 |
| Libya | 5.0981277 | 2.3138213 | 4.3386344 | 5.815742 | 1.8278579 |
| Lithuania | 1.6191482 | 0.7972886 | 2.3387571 | 3.272368 | 0.6477350 |
| Luxembourg | 1.2950718 | 0.1957404 | 0.8058929 | 0.849370 | 0.1853458 |
| Madagascar | 31.1092423 | 7.4839241 | 10.7079077 | 11.980900 | 10.7912667 |
| Malawi | 22.2841641 | 4.5056365 | 7.0126155 | 11.620344 | 7.5729071 |
| Malaysia | 3.9554664 | 1.4521413 | 2.9955138 | 3.517051 | 1.1658729 |
| Maldives | 2.7047743 | 1.0500712 | 2.3796137 | 2.358517 | 0.8018499 |
| Mali | 63.9562447 | 8.4493229 | 10.0358153 | 11.905534 | 13.7909580 |
| Malta | 2.3055480 | 0.5795598 | 1.0678000 | 1.464713 | 0.2308468 |
| Marshall Islands | 16.7529500 | 2.8232825 | 5.5255067 | 7.036392 | 3.5717020 |
| Mauritania | 42.2282123 | 2.1097068 | 10.0989625 | 13.299362 | 5.1972947 |
| Mauritius | 5.8810299 | 0.9773616 | 2.9044864 | 4.942630 | 1.0184094 |
| Mexico | 5.6494251 | 1.4384773 | 4.3770364 | 7.168616 | 1.0922826 |
| Micronesia (Federated States of) | 13.7407078 | 2.6914813 | 5.2969374 | 6.790392 | 3.3242824 |
| Monaco | 1.4081122 | 0.4581520 | 1.3902452 | 2.066367 | 0.3849248 |
| Mongolia | 7.5560737 | 1.8097753 | 3.5568817 | 5.107854 | 1.6071112 |
| Montenegro | 1.0239866 | 0.4407209 | 1.2478445 | 2.181721 | 0.5148877 |
| Morocco | 7.8749357 | 0.9801402 | 3.5486712 | 4.166328 | 1.6107269 |
| Mozambique | 47.0450795 | 7.3077029 | 7.5987325 | 21.265946 | 6.3520776 |
| Myanmar | 22.7210589 | 2.2416207 | 3.2981870 | 5.828985 | 2.5087942 |
| Namibia | 23.6788357 | 5.1134174 | 7.4493567 | 13.942099 | 6.0596305 |
| Nauru | 11.1872544 | 2.7643415 | 5.4412470 | 6.925362 | 3.4796433 |
| Nepal | 11.2344697 | 2.2503434 | 4.4566493 | 5.997941 | 3.0150929 |
| Netherlands | 1.4561172 | 0.3838528 | 1.0293658 | 1.447871 | 0.2904465 |
| New Zealand | 2.1115191 | 0.5518580 | 1.8040974 | 2.384735 | 0.3992734 |
| Nicaragua | 6.4968095 | 1.9946202 | 3.9792533 | 5.975117 | 1.3433701 |
| Niger | 57.5041138 | 14.7864779 | 10.2875186 | 16.980995 | 15.7382067 |
| Nigeria | 84.3763615 | 7.9336119 | 8.5316830 | 10.506583 | 13.4412207 |
| Niue | 10.7873571 | 2.2764209 | 4.6684903 | 5.991759 | 2.6822217 |
| North Macedonia | 2.2236208 | 0.7666337 | 1.2388595 | 1.557852 | 0.6118348 |
| Norway | 1.0435620 | 0.3742343 | 1.2676190 | 2.090803 | 0.3182938 |
| Oman | 6.1964258 | 1.2651822 | 2.3937890 | 3.316748 | 1.2512152 |
| Pakistan | 27.1447612 | 3.7883779 | 6.0056966 | 5.571274 | 4.5811056 |
| Palau | 8.0407989 | 1.8941470 | 6.5009327 | 10.134594 | 2.0607376 |
| Panama | 6.3343440 | 1.6360535 | 3.0075142 | 5.897058 | 1.2557959 |
| Papua New Guinea | 23.3697903 | 3.5506668 | 6.6310170 | 8.369929 | 4.8693675 |
| Paraguay | 8.6793894 | 1.9646842 | 4.3023711 | 6.445637 | 0.8455794 |
| Peru | 6.9008918 | 1.4626914 | 2.2796866 | 4.246283 | 1.3802739 |
| Philippines | 14.1791712 | 1.9821967 | 3.3532863 | 5.646583 | 2.0488686 |
| Poland | 1.6805108 | 0.5834245 | 1.7732725 | 2.814470 | 0.4469298 |
| Portugal | 1.7143724 | 0.4248140 | 1.0378156 | 1.622165 | 0.3642995 |
| Qatar | 3.1289284 | 0.6997520 | 1.7008061 | 1.409168 | 0.6822453 |
| Republic of Korea | 1.6556651 | 0.3998070 | 1.0873875 | 1.633250 | 0.3782244 |
| Republic of Moldova | 3.7351585 | 1.4944998 | 2.9989126 | 4.221472 | 1.1667434 |
| Romania | 3.5414903 | 0.8967057 | 2.0851209 | 2.562165 | 0.7638357 |
| Russian Federation | 3.1466532 | 1.1090418 | 2.8478324 | 4.659971 | 0.8249106 |
| Rwanda | 18.7496800 | 4.5290536 | 5.8898185 | 9.339797 | 4.9849060 |
| Saint Kitts and Nevis | 5.1373159 | 1.5867078 | 6.0450558 | 10.165843 | 1.3370655 |
| Saint Lucia | 9.7116180 | 1.4003343 | 4.1658116 | 5.067985 | 1.6820363 |
| Saint Vincent and the Grenadines | 5.5743651 | 3.1895462 | 6.0392897 | 7.758409 | 1.5850821 |
| Samoa | 6.8486518 | 1.7059550 | 3.7033754 | 4.852195 | 1.8095991 |
| San Marino | 0.8984766 | 0.2920537 | 0.9259376 | 1.394484 | 0.2195683 |
| Sao Tome and Principe | 15.9968189 | 2.9806805 | 6.1484500 | 11.766265 | 3.0388248 |
| Saudi Arabia | 2.9953618 | 0.9094038 | 5.3001788 | 6.825530 | 0.8377416 |
| Senegal | 23.8695364 | 4.6807802 | 10.1099725 | 9.053694 | 5.7389793 |
| Serbia | 2.1032657 | 0.6985765 | 1.3896947 | 1.957962 | 0.4963845 |
| Seychelles | 5.6851333 | 1.3400156 | 5.8195123 | 5.064279 | 1.2026957 |
| Sierra Leone | 80.5697947 | 8.0085523 | 24.9021402 | 27.940298 | 13.6708138 |
| Singapore | 1.6326441 | 0.3814820 | 0.8521695 | 1.196415 | 0.3423577 |
| Slovakia | 2.8509167 | 0.6649278 | 1.6872154 | 2.467630 | 0.5703238 |
| Slovenia | 0.9174696 | 0.4017523 | 1.3259491 | 1.870494 | 0.3088003 |
| Solomon Islands | 11.5315645 | 2.0479983 | 4.2768006 | 5.544760 | 2.3111283 |
| Somalia | 83.1757811 | 8.6976662 | 17.2270911 | 25.858580 | 16.8142377 |
| South Africa | 23.2714252 | 2.9672468 | 7.6430579 | 12.428865 | 2.5050008 |
| South Sudan | 59.9386379 | 7.5420512 | 15.1351874 | 22.889002 | 13.6043951 |
| Spain | 1.3014901 | 0.3764760 | 0.9145221 | 1.381945 | 0.3305631 |
| Sri Lanka | 2.8461624 | 0.9142782 | 1.5588859 | 2.452361 | 0.7510131 |
| State of Palestine | 8.8719052 | 1.9303579 | 3.4157602 | 4.028173 | 1.1408087 |
| Sudan | 32.0678188 | 2.6879419 | 10.8695933 | 16.680105 | 5.4881928 |
| Suriname | 6.8564852 | 1.6778527 | 3.2470821 | 4.579067 | 1.2576129 |
| Sweden | 1.1929759 | 0.4045116 | 1.2092377 | 2.307922 | 0.2848366 |
| Switzerland | 1.2509577 | 0.3653644 | 1.1127592 | 1.400175 | 0.3014526 |
| Syrian Arab Republic | 10.8654771 | 5.3720498 | 7.1135794 | 9.797946 | 4.6595918 |
| Tajikistan | 19.0839727 | 0.8311735 | 1.6130785 | 2.913015 | 0.6307438 |
| Thailand | 3.7218859 | 2.5525572 | 6.0812481 | 6.633417 | 1.6384618 |
| Timor-Leste | 25.1299422 | 3.5083928 | 15.0085523 | 12.048637 | 4.8126871 |
| Togo | 43.1638545 | 5.5935245 | 7.5881047 | 10.153845 | 7.2848656 |
| Tonga | 9.2678615 | 0.8155921 | 3.0854914 | 5.070496 | 1.5564602 |
| Trinidad and Tobago | 6.0539630 | 1.4080118 | 3.5521702 | 7.021582 | 0.9446353 |
| Tunisia | 4.9851914 | 1.6335485 | 3.1066112 | 4.453127 | 1.6061351 |
| Turkey | 4.7932084 | 1.0492660 | 1.9712052 | 2.303867 | 0.9231292 |
| Turkmenistan | 18.8520231 | 1.8723180 | 4.4591110 | 5.726579 | 1.8300366 |
| Tuvalu | 7.9663223 | 2.3430279 | 4.7413824 | 6.125401 | 2.7537745 |
| Uganda | 26.3872999 | 5.3158730 | 13.3920262 | 14.002877 | 8.5960499 |
| Ukraine | 3.3878043 | 0.9469795 | 2.3997620 | 3.754843 | 0.7748358 |
| United Arab Emirates | 3.5237043 | 0.9867795 | 2.3302245 | 2.847775 | 0.9190207 |
| United Kingdom of Great Britain and Northern Ireland | 1.5064718 | 0.4150586 | 1.2925340 | 1.902278 | 0.3528425 |
| United Republic of Tanzania | 30.6242062 | 3.3594415 | 7.0383473 | 10.746122 | 8.1233196 |
| United States of America | 2.7839819 | 0.7632219 | 2.6498912 | 5.130776 | 0.6099627 |
| Uruguay | 2.8561140 | 0.9380442 | 3.3818355 | 5.456138 | 0.6394778 |
| Uzbekistan | 7.5836865 | 1.9312156 | 3.6862096 | 4.338242 | 1.8370064 |
| Vanuatu | 14.6899966 | 2.4674453 | 4.9540199 | 6.363469 | 2.9669111 |
| Venezuela (Bolivarian Republic of) | 9.7503935 | 1.9885049 | 10.6795683 | 15.654086 | 1.4687534 |
| Viet Nam | 9.5705442 | 1.5068004 | 2.9543769 | 3.665779 | 1.0143663 |
| World | 20.5756550 | 2.8979851 | 4.8932053 | 6.339351 | 3.8260097 |
| Yemen | 32.5700832 | 6.3331305 | 10.7226614 | 14.552075 | 6.2824950 |
| Zambia | 39.2980605 | 4.0278394 | 9.2943329 | 12.526980 | 6.9729929 |
| Zimbabwe | 29.5120090 | 6.6928006 | 9.6549163 | 14.475032 | 5.1928487 |
highestMortalityRate <- unicefDf %>%
select(Country, `Mortality rate 1-59 months`, `Mortality rate age 5-9`, `Mortality rate age 10-14`, `Mortality rate age 15-19`, `Mortality rate age 20-24`) %>%
arrange(desc(`Mortality rate 1-59 months`)) %>%
ungroup() %>%
top_n(10, `Mortality rate 1-59 months`)
kable(highestMortalityRate,caption = "Mortality rates (deaths / 1000 births) by Country for year of 2019", format = "html") %>% kable_styling("striped") %>% scroll_box(width = "100%", height="100%")| Country | Mortality rate 1-59 months | Mortality rate age 5-9 | Mortality rate age 10-14 | Mortality rate age 15-19 | Mortality rate age 20-24 |
|---|---|---|---|---|---|
| Nigeria | 84.37636 | 13.441221 | 7.933612 | 8.531683 | 10.506583 |
| Chad | 83.30102 | 15.207849 | 10.641506 | 15.525497 | 19.564061 |
| Somalia | 83.17578 | 16.814238 | 8.697666 | 17.227091 | 25.858580 |
| Sierra Leone | 80.56979 | 13.670814 | 8.008552 | 24.902140 | 27.940298 |
| Central African Republic | 73.22873 | 9.051233 | 5.153523 | 11.288133 | 23.648029 |
| Guinea | 70.57908 | 12.626305 | 6.229546 | 13.290056 | 18.447630 |
| Mali | 63.95624 | 13.790958 | 8.449323 | 10.035815 | 11.905534 |
| Burkina Faso | 63.23894 | 11.130952 | 6.331126 | 6.069151 | 9.976072 |
| Benin | 61.61026 | 12.532683 | 7.153629 | 11.179638 | 11.155139 |
| South Sudan | 59.93864 | 13.604395 | 7.542051 | 15.135187 | 22.889002 |
highestMortalityRate %>%
pivot_longer(-Country)%>%
ggplot(aes(x = fct_inorder(name), y = value, col = `Country`)) +
geom_point() +
geom_line() +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))## geom_path: Each group consists of only one observation. Do you need to adjust
## the group aesthetic?
lowestMortalityRate <- unicefDf %>%
select(Country, `Mortality rate 1-59 months`, `Mortality rate age 5-9`, `Mortality rate age 10-14`, `Mortality rate age 15-19`, `Mortality rate age 20-24`) %>%
arrange((`Mortality rate 1-59 months`)) %>%
ungroup() %>%
head(10, `Mortality rate 1-59 months`)
kable(lowestMortalityRate,caption = "Mortality rates (deaths / 1000 births) by Country for year of 2029", format = "html") %>% kable_styling("striped") %>% scroll_box(width = "100%")| Country | Mortality rate 1-59 months | Mortality rate age 5-9 | Mortality rate age 10-14 | Mortality rate age 15-19 | Mortality rate age 20-24 |
|---|---|---|---|---|---|
| Denmark | 0.7640785 | 0.3099458 | 0.3034473 | 1.0216163 | 1.378119 |
| San Marino | 0.8984766 | 0.2195683 | 0.2920537 | 0.9259376 | 1.394484 |
| Slovenia | 0.9174696 | 0.3088003 | 0.4017523 | 1.3259491 | 1.870494 |
| Iceland | 0.9694852 | 0.2181838 | 0.2568733 | 1.4768768 | 1.422293 |
| Cyprus | 0.9819611 | 0.4783974 | 0.4080798 | 1.1525641 | 1.854223 |
| Finland | 0.9935902 | 0.2686926 | 0.3967236 | 1.8510651 | 3.066747 |
| Montenegro | 1.0239866 | 0.5148877 | 0.4407209 | 1.2478445 | 2.181721 |
| Norway | 1.0435620 | 0.3182938 | 0.3742343 | 1.2676190 | 2.090803 |
| Ireland | 1.1776630 | 0.2843018 | 0.3227365 | 0.8419783 | 1.561325 |
| Sweden | 1.1929759 | 0.2848366 | 0.4045116 | 1.2092377 | 2.307922 |
lowestMortalityRate %>%
pivot_longer(-Country)%>%
ggplot(aes(x = fct_inorder(name), y = value, col = `Country`)) +
geom_point() +
geom_line() +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))## geom_path: Each group consists of only one observation. Do you need to adjust
## the group aesthetic?
Conclusion
It appears that there is somewhat of a trend when it comes to mortality rates in high vs. low mortality rate countries. Looking at my plots for the high mortality rate countries it appears that there is a dramatic difference in mortality rate after the first 59 months of life. While the mortality rates do seem to creep upwards as people get older they it would appear your chances of surviving if you survive past your first 59 months are much higher in high mortality rate countries.
The trend is similar in the low mortality rate countries but the drop off in mortality rate is not nearly as dramatic after 59 months. The other interesting thing I noticed about the low mortality rate countries is that in the older age groups, 15-19 and 20-24, the mortality rate starts spreading out between countries.
References
Dataset
https://bbhosted.cuny.edu/webapps/discussionboard/do/message?action=list_messages&course_id=_2010109_1&nav=discussion_board_entry&conf_id=_2342994_1&forum_id=_2992508_1&message_id=_53934801_1↩︎
Wide & long data - GitHub Pages. (n.d.). Retrieved October 4, 2021, from https://sejdemyr.github.io/r-tutorials/basics/wide-and-long/.↩︎
CME Info - child mortality estimates. (n.d.). Retrieved October 4, 2021, from https://childmortality.org/data.↩︎
CME Info - child mortality estimates. (n.d.). Retrieved October 4, 2021, from https://childmortality.org/data.↩︎