The aim of this analysis is to analyze the common Dietary Consumption trends among countries with better COVID 19 health outcomes by utilizing global data including Population, COVID 19 statistics (Confirmed, Deaths, Recovered, Active), and Annual Caloric consumption per Food Group in each country. The COVID 19 data covered the period of April 22, 2020 until February 06 2021.

This analysis uses a public data set from Kaggle by Maria Ren. click here link

The original sources of the data used include the Food and Agriculture Organization link, Johns Hopkins Center for Systems Science and Engineering link, and the Population Reference Beaureu link

Setting Up The Environment

Note: installing and loading the the necessary packages

install.packages(c("dplyr", "tidyr", 
                   "readr", "ggplot2", "summarytools", "lubridate", "stringr", 
                   "readxl"))
## Installing packages into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
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(readr)
library(ggplot2)
library(summarytools)
## Warning in fun(libname, pkgname): couldn't connect to display ":0"
## system might not have X11 capabilities; in case of errors when using dfSummary(), set st_options(use.x11 = FALSE)
library(lubridate)
## 
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
## 
##     date, intersect, setdiff, union
library(stringr)
library(readxl)

Data Preparation

Note: Uploading the raw data I’ll be using and exploring its contents

covid_diet_data <- read.csv("Food_Supply_kcal_Data.csv")
head(covid_diet_data)
##               Country Alcoholic.Beverages Animal.Products Animal.fats
## 1         Afghanistan              0.0000          4.7774      0.8504
## 2             Albania              0.9120         16.0930      1.0591
## 3             Algeria              0.0896          6.0326      0.1941
## 4              Angola              1.9388          4.6927      0.2644
## 5 Antigua and Barbuda              2.3041         15.3672      1.5429
## 6           Argentina              1.4354         14.9869      1.0650
##   Aquatic.Products..Other Cereals...Excluding.Beer   Eggs Fish..Seafood
## 1                       0                  37.1186 0.1501        0.0000
## 2                       0                  16.2107 0.8091        0.1471
## 3                       0                  25.0112 0.4181        0.1195
## 4                       0                  18.3521 0.0441        0.8372
## 5                       0                  13.7215 0.2057        1.7280
## 6                       0                  16.7927 0.8643        0.2006
##   Fruits...Excluding.Wine   Meat Milk...Excluding.Butter Miscellaneous Offals
## 1                  1.4757 1.2006                  2.4512        0.0250 0.1251
## 2                  3.8982 3.8688                  9.9441        0.0588 0.2648
## 3                  3.1805 1.2543                  3.9869        0.1045 0.0597
## 4                  2.3133 2.9302                  0.5067        0.0661 0.1102
## 5                  3.6824 7.0356                  4.6904        0.3086 0.1646
## 6                  1.4663 9.4459                  3.1641        0.0000 0.2624
##   Oilcrops Pulses Spices Starchy.Roots Stimulants Sugar.Crops
## 1   0.1751 0.5003 0.1001        0.3252     0.0750           0
## 2   1.0886 0.8091 0.0000        1.2651     0.2501           0
## 3   0.2688 1.0900 0.1195        1.9262     0.1493           0
## 4   1.0795 1.4981 0.0000       12.6239     0.0441           0
## 5   0.5966 0.4526 0.3497        0.8434     0.4937           0
## 6   0.0309 0.1235 0.0309        1.4045     0.2315           0
##   Sugar...Sweeteners Treenuts Vegetal.Products Vegetable.Oils Vegetables
## 1             2.2261   0.1251          45.2476         2.3012     0.7504
## 2             3.4422   0.3972          33.9070         2.8244     2.7508
## 3             3.9869   0.2240          43.9749         5.7638     2.0457
## 4             2.7539   0.0000          45.3184         4.2741     0.3525
## 5             5.8218   0.0823          34.6225         4.6904     1.2960
## 6             7.0536   0.0463          34.9900         5.5410     0.8643
##   Obesity Undernourished  Confirmed      Deaths Recovered      Active
## 1     4.5           29.8 0.14213420 0.006185779 0.1233739 0.012574497
## 2    22.3            6.2 2.96730092 0.050951374 1.7926357 1.123713883
## 3    26.6            3.9 0.24489708 0.006558153 0.1675722 0.070766734
## 4     6.8             25 0.06168747 0.001460550 0.0568077 0.003419224
## 5    19.1           <NA> 0.29387755 0.007142857 0.1908163 0.095918367
## 6    28.5            4.6 4.35614739 0.108226635 3.9051921 0.342728695
##   Population Unit..all.except.Population.
## 1   38928000                            %
## 2    2838000                            %
## 3   44357000                            %
## 4   32522000                            %
## 5      98000                            %
## 6   45377000                            %
str(covid_diet_data)
## 'data.frame':    170 obs. of  32 variables:
##  $ Country                     : chr  "Afghanistan" "Albania" "Algeria" "Angola" ...
##  $ Alcoholic.Beverages         : num  0 0.912 0.0896 1.9388 2.3041 ...
##  $ Animal.Products             : num  4.78 16.09 6.03 4.69 15.37 ...
##  $ Animal.fats                 : num  0.85 1.059 0.194 0.264 1.543 ...
##  $ Aquatic.Products..Other     : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ Cereals...Excluding.Beer    : num  37.1 16.2 25 18.4 13.7 ...
##  $ Eggs                        : num  0.1501 0.8091 0.4181 0.0441 0.2057 ...
##  $ Fish..Seafood               : num  0 0.147 0.119 0.837 1.728 ...
##  $ Fruits...Excluding.Wine     : num  1.48 3.9 3.18 2.31 3.68 ...
##  $ Meat                        : num  1.2 3.87 1.25 2.93 7.04 ...
##  $ Milk...Excluding.Butter     : num  2.451 9.944 3.987 0.507 4.69 ...
##  $ Miscellaneous               : num  0.025 0.0588 0.1045 0.0661 0.3086 ...
##  $ Offals                      : num  0.1251 0.2648 0.0597 0.1102 0.1646 ...
##  $ Oilcrops                    : num  0.175 1.089 0.269 1.079 0.597 ...
##  $ Pulses                      : num  0.5 0.809 1.09 1.498 0.453 ...
##  $ Spices                      : num  0.1 0 0.119 0 0.35 ...
##  $ Starchy.Roots               : num  0.325 1.265 1.926 12.624 0.843 ...
##  $ Stimulants                  : num  0.075 0.2501 0.1493 0.0441 0.4937 ...
##  $ Sugar.Crops                 : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ Sugar...Sweeteners          : num  2.23 3.44 3.99 2.75 5.82 ...
##  $ Treenuts                    : num  0.1251 0.3972 0.224 0 0.0823 ...
##  $ Vegetal.Products            : num  45.2 33.9 44 45.3 34.6 ...
##  $ Vegetable.Oils              : num  2.3 2.82 5.76 4.27 4.69 ...
##  $ Vegetables                  : num  0.75 2.751 2.046 0.352 1.296 ...
##  $ Obesity                     : num  4.5 22.3 26.6 6.8 19.1 28.5 20.9 30.4 21.9 19.9 ...
##  $ Undernourished              : chr  "29.8" "6.2" "3.9" "25" ...
##  $ Confirmed                   : num  0.1421 2.9673 0.2449 0.0617 0.2939 ...
##  $ Deaths                      : num  0.00619 0.05095 0.00656 0.00146 0.00714 ...
##  $ Recovered                   : num  0.1234 1.7926 0.1676 0.0568 0.1908 ...
##  $ Active                      : num  0.01257 1.12371 0.07077 0.00342 0.09592 ...
##  $ Population                  : num  38928000 2838000 44357000 32522000 98000 ...
##  $ Unit..all.except.Population.: chr  "%" "%" "%" "%" ...
colnames(covid_diet_data)
##  [1] "Country"                      "Alcoholic.Beverages"         
##  [3] "Animal.Products"              "Animal.fats"                 
##  [5] "Aquatic.Products..Other"      "Cereals...Excluding.Beer"    
##  [7] "Eggs"                         "Fish..Seafood"               
##  [9] "Fruits...Excluding.Wine"      "Meat"                        
## [11] "Milk...Excluding.Butter"      "Miscellaneous"               
## [13] "Offals"                       "Oilcrops"                    
## [15] "Pulses"                       "Spices"                      
## [17] "Starchy.Roots"                "Stimulants"                  
## [19] "Sugar.Crops"                  "Sugar...Sweeteners"          
## [21] "Treenuts"                     "Vegetal.Products"            
## [23] "Vegetable.Oils"               "Vegetables"                  
## [25] "Obesity"                      "Undernourished"              
## [27] "Confirmed"                    "Deaths"                      
## [29] "Recovered"                    "Active"                      
## [31] "Population"                   "Unit..all.except.Population."
summary(covid_diet_data)
##    Country          Alcoholic.Beverages Animal.Products   Animal.fats    
##  Length:170         Min.   :0.0000      Min.   : 1.624   Min.   :0.0000  
##  Class :character   1st Qu.:0.3613      1st Qu.: 5.083   1st Qu.:0.3428  
##  Mode  :character   Median :1.2446      Median : 9.034   Median :0.8775  
##                     Mean   :1.3252      Mean   : 9.295   Mean   :1.2674  
##                     3rd Qu.:2.0280      3rd Qu.:13.175   3rd Qu.:1.7632  
##                     Max.   :5.1574      Max.   :22.291   Max.   :7.8007  
##                                                                          
##  Aquatic.Products..Other Cereals...Excluding.Beer      Eggs       
##  Min.   :0.000000        Min.   : 8.957           Min.   :0.0188  
##  1st Qu.:0.000000        1st Qu.:15.306           1st Qu.:0.1410  
##  Median :0.000000        Median :19.620           Median :0.4037  
##  Mean   :0.002786        Mean   :20.365           Mean   :0.4285  
##  3rd Qu.:0.000000        3rd Qu.:24.841           3rd Qu.:0.6330  
##  Max.   :0.400700        Max.   :37.526           Max.   :1.4461  
##                                                                   
##  Fish..Seafood    Fruits...Excluding.Wine      Meat       
##  Min.   :0.0000   Min.   :0.1471          Min.   : 0.298  
##  1st Qu.:0.2402   1st Qu.:1.2245          1st Qu.: 2.081  
##  Median :0.4783   Median :1.6948          Median : 3.687  
##  Mean   :0.6315   Mean   :2.0120          Mean   : 3.896  
##  3rd Qu.:0.8697   3rd Qu.:2.3707          3rd Qu.: 5.278  
##  Max.   :4.4183   Max.   :8.8540          Max.   :10.567  
##                                                           
##  Milk...Excluding.Butter Miscellaneous         Offals           Oilcrops      
##  Min.   :0.1169          Min.   :0.00000   Min.   :0.00000   Min.   : 0.0179  
##  1st Qu.:1.1078          1st Qu.:0.02470   1st Qu.:0.07825   1st Qu.: 0.2993  
##  Median :2.7198          Median :0.08805   Median :0.11825   Median : 0.6363  
##  Mean   :2.9245          Mean   :0.15933   Mean   :0.14122   Mean   : 1.1035  
##  3rd Qu.:4.3196          3rd Qu.:0.19173   3rd Qu.:0.17663   3rd Qu.: 1.1902  
##  Max.   :9.9441          Max.   :1.18220   Max.   :0.80150   Max.   :10.4822  
##                                                                               
##      Pulses           Spices        Starchy.Roots       Stimulants     
##  Min.   :0.0000   Min.   :0.00000   Min.   : 0.2938   Min.   :0.00000  
##  1st Qu.:0.2967   1st Qu.:0.03635   1st Qu.: 1.1123   1st Qu.:0.07765  
##  Median :0.7084   Median :0.08590   Median : 1.5449   Median :0.20675  
##  Mean   :1.1089   Mean   :0.18320   Mean   : 3.0839   Mean   :0.30537  
##  3rd Qu.:1.5472   3rd Qu.:0.22798   3rd Qu.: 2.9245   3rd Qu.:0.42080  
##  Max.   :7.5638   Max.   :1.22020   Max.   :19.6759   Max.   :2.00900  
##                                                                        
##   Sugar.Crops      Sugar...Sweeteners    Treenuts       Vegetal.Products
##  Min.   :0.00000   Min.   :0.6786     Min.   :0.00000   Min.   :27.71   
##  1st Qu.:0.00000   1st Qu.:3.4222     1st Qu.:0.04662   1st Qu.:36.83   
##  Median :0.00000   Median :4.6784     Median :0.17400   Median :40.97   
##  Mean   :0.01788   Mean   :4.8212     Mean   :0.26162   Mean   :40.71   
##  3rd Qu.:0.00000   3rd Qu.:6.3458     3rd Qu.:0.38958   3rd Qu.:44.94   
##  Max.   :0.59300   Max.   :9.5492     Max.   :1.42100   Max.   :48.39   
##                                                                         
##  Vegetable.Oils      Vegetables        Obesity      Undernourished    
##  Min.   : 0.9325   Min.   :0.0957   Min.   : 2.10   Length:170        
##  1st Qu.: 3.1263   1st Qu.:0.6026   1st Qu.: 8.50   Class :character  
##  Median : 4.6607   Median :1.0031   Median :21.20   Mode  :character  
##  Mean   : 4.8724   Mean   :1.0863   Mean   :18.71                     
##  3rd Qu.: 6.4279   3rd Qu.:1.3670   3rd Qu.:25.70                     
##  Max.   :10.3839   Max.   :3.3524   Max.   :45.60                     
##                                     NA's   :3                         
##    Confirmed             Deaths           Recovered           Active       
##  Min.   : 0.000312   Min.   :0.000000   Min.   :0.00000   Min.   :0.00000  
##  1st Qu.: 0.140976   1st Qu.:0.002013   1st Qu.:0.09911   1st Qu.:0.01203  
##  Median : 1.011570   Median :0.011998   Median :0.47540   Median :0.08104  
##  Mean   : 2.021972   Mean   :0.039370   Mean   :1.45236   Mean   :0.53516  
##  3rd Qu.: 3.487069   3rd Qu.:0.069503   3rd Qu.:2.62287   3rd Qu.:0.35818  
##  Max.   :10.408199   Max.   :0.185428   Max.   :9.03987   Max.   :8.01982  
##  NA's   :6           NA's   :6          NA's   :6         NA's   :8        
##    Population        Unit..all.except.Population.
##  Min.   :5.400e+04   Length:170                  
##  1st Qu.:2.816e+06   Class :character            
##  Median :1.018e+07   Mode  :character            
##  Mean   :4.452e+07                               
##  3rd Qu.:3.272e+07                               
##  Max.   :1.402e+09                               
## 

Data Cleaning and Processing

Note: Involved removing blanks, NA and duplicated values, unifying data formats and other necessary filtering and organizing

sum(is.na(covid_diet_data)) #identified the NA values
## [1] 36
options(scipen = 999) #removed the scientific notation function for some values
covid_diet_data$Confirmed <- round(covid_diet_data$Confirmed, 4)  #limited the number of maximum 
# decimal places for the Confirmed column to 4

note: converted the data formats for the columns Confirmed, Deaths, Recovered and Active into whole number from percentage format to match the Population data which I will use together with data for these columns later for further calculations.

covid_diet_data$Confirmed <- round(covid_diet_data$Confirmed * 100)
covid_diet_data$Deaths <- round(covid_diet_data$Deaths * 100)
covid_diet_data$Recovered <- round(covid_diet_data$Recovered * 100)
covid_diet_data$Active <- round(covid_diet_data$Active * 100)
covid_diet_data_clean <- na.omit(covid_diet_data) #removed non numeric row values.
covid_diet_data_unique <- covid_diet_data_clean[!duplicated(covid_diet_data_clean$Country) &                                            !duplicated(covid_diet_data_clean$Country, fromLast = TRUE), ] #removed duplicates form the "Country" column

Note: In this section I focused on removing and merging food category columns that had negligible nutritive values and those that essentially fell under the same food category.

covid_diet_data_unique <- subset(covid_diet_data_unique, select = -Alcoholic.Beverages)
covid_diet_data_unique <- subset(covid_diet_data_unique, select = -Stimulants)
columns_to_sum <-c("Animal.fats", "Oilcrops", "Vegetable.Oils")
covid_diet_data_unique$Fats.and.Oils <- rowSums(covid_diet_data_unique[columns_to_sum])
columns_to_sum <-c("Sugar.Crops", "Sugar...Sweeteners")
covid_diet_data_unique$SugarCrops.and.Sweeteners <- rowSums(covid_diet_data_unique[columns_to_sum])
print(as_tibble(head(covid_diet_data_unique, 20)))
## # A tibble: 20 × 32
##    Country                Animal.Products Animal.fats Aquatic.Products..Other
##    <chr>                            <dbl>       <dbl>                   <dbl>
##  1 Afghanistan                       4.78      0.850                        0
##  2 Albania                          16.1       1.06                         0
##  3 Algeria                           6.03      0.194                        0
##  4 Angola                            4.69      0.264                        0
##  5 Argentina                        15.0       1.06                         0
##  6 Armenia                          12.8       1.77                         0
##  7 Australia                        15.6       1.90                         0
##  8 Austria                          15.6       5.25                         0
##  9 Azerbaijan                        8.17      1.30                         0
## 10 Bangladesh                        2.37      0.154                        0
## 11 Barbados                         12.1       1.16                         0
## 12 Belarus                          12.3       2.67                         0
## 13 Belgium                          14.2       4.78                         0
## 14 Belize                            9.18      2.61                         0
## 15 Benin                             2.49      0.0907                       0
## 16 Bolivia                          10.0       0.913                        0
## 17 Bosnia and Herzegovina            9.06      0.551                        0
## 18 Botswana                          8.12      1.05                         0
## 19 Brazil                           13.2       1.52                         0
## 20 Bulgaria                         12.3       2.46                         0
## # ℹ 28 more variables: Cereals...Excluding.Beer <dbl>, Eggs <dbl>,
## #   Fish..Seafood <dbl>, Fruits...Excluding.Wine <dbl>, Meat <dbl>,
## #   Milk...Excluding.Butter <dbl>, Miscellaneous <dbl>, Offals <dbl>,
## #   Oilcrops <dbl>, Pulses <dbl>, Spices <dbl>, Starchy.Roots <dbl>,
## #   Sugar.Crops <dbl>, Sugar...Sweeteners <dbl>, Treenuts <dbl>,
## #   Vegetal.Products <dbl>, Vegetable.Oils <dbl>, Vegetables <dbl>,
## #   Obesity <dbl>, Undernourished <chr>, Confirmed <dbl>, Deaths <dbl>, …
columns_to_sum <-c("Meat", "Offals")
covid_diet_data_unique$Meat.and.ByProducts <- rowSums(covid_diet_data_unique[columns_to_sum])
columns_to_sum <-c("Vegetables", "Vegetal.Products")
covid_diet_data_unique$Vegetables.and.products <- rowSums(covid_diet_data_unique[columns_to_sum])
columns_to_sum <-c("Aquatic.Products..Other", 
"Fish..Seafood")

covid_diet_data_unique$Fish.Seafood.and.Products <- rowSums(covid_diet_data_unique[columns_to_sum])
columns_to_sum <-c("Animal.Products", "Meat.and.ByProducts")

covid_diet_data_unique$Meat.and.Products <- rowSums(covid_diet_data_unique[columns_to_sum])
columns_to_sum <-c("Cereals...Excluding.Beer", "Starchy.Roots")

covid_diet_data_unique$Grains <- rowSums(covid_diet_data_unique[columns_to_sum])
columns_to_sum <-c("Pulses", "Treenuts")

covid_diet_data_unique$Legumes.and.Nuts <- rowSums(covid_diet_data_unique[columns_to_sum])

note: Here I changed the column name ““Unit..all.except.Population” into “Unit.for.FoodCategories.NutritionStatus.HealthRates” to specify that only the Food Category columns are in Percentage format, while the rest are in whole number format.

colnames(covid_diet_data_unique)[colnames(covid_diet_data_unique) == "Unit..all.except.Population."] <- "Unit.for.FoodCategories.NutritionStatus.HealthRates"

#The categories of Dietary Diversity Score, Population, Deaths, Confirmed, Active, Recovered are not in whole number format to aid the calculations for analysis.
covid_diet_data_unique <- subset(covid_diet_data_unique, select = -c(Sugar.Crops, Sugar...Sweeteners)) 
covid_diet_data_unique <- subset(covid_diet_data_unique, select = -c(Pulses, Treenuts, Fish..Seafood, Aquatic.Products..Other, Cereals...Excluding.Beer, Starchy.Roots, Animal.Products, Miscellaneous, Meat.and.ByProducts)) 

Data Analysis

#Calculations

#Demographic Calculations

Note: This area focuses on making calculations using the Non Food Category Columns to be used for my analysis later.

covid_diet_data_unique$MortalityRate <- (covid_diet_data_unique$Deaths / 
covid_diet_data_unique$
Confirmed) * 100 
covid_diet_data_unique$MorbidityRate <- (covid_diet_data_unique$Confirmed /                            covid_diet_data_unique$
Population) * 100
covid_diet_data_unique$RecoveryRate <- (covid_diet_data_unique$Recovered /                            covid_diet_data_unique$
Confirmed) * 100
covid_diet_data_unique <- covid_diet_data_unique[apply(covid_diet_data_unique[, c("MortalityRate", 
"MorbidityRate", "RecoveryRate")], 1, 
function(x) all(!is.na(as.numeric(x)))), ]

#ensuring all blanks and NA values were removed in data frame

# This is the cleaned data frame
print(as_tibble(head(covid_diet_data_unique, 20)))
## # A tibble: 20 × 30
##    Country                Animal.fats   Eggs Fruits...Excluding.Wine  Meat
##    <chr>                        <dbl>  <dbl>                   <dbl> <dbl>
##  1 Afghanistan                 0.850  0.150                    1.48  1.20 
##  2 Albania                     1.06   0.809                    3.90  3.87 
##  3 Algeria                     0.194  0.418                    3.18  1.25 
##  4 Angola                      0.264  0.0441                   2.31  2.93 
##  5 Argentina                   1.06   0.864                    1.47  9.45 
##  6 Armenia                     1.77   0.731                    2.53  4.22 
##  7 Australia                   1.90   0.468                    1.66  7.49 
##  8 Austria                     5.25   0.785                    1.60  5.01 
##  9 Azerbaijan                  1.30   0.548                    1.61  2.93 
## 10 Bangladesh                  0.154  0.231                    0.655 0.347
## 11 Barbados                    1.16   0.587                    1.93  5.66 
## 12 Belarus                     2.67   0.851                    1.40  5.71 
## 13 Belgium                     4.78   0.69                     1.38  3.28 
## 14 Belize                      2.61   0.297                    2.52  3.95 
## 15 Benin                       0.0907 0.0544                   0.762 1.20 
## 16 Bolivia                     0.913  0.552                    2.42  6.75 
## 17 Bosnia and Herzegovina      0.551  0.291                    1.90  3.03 
## 18 Botswana                    1.05   0.107                    1.03  1.88 
## 19 Brazil                      1.52   0.446                    1.72  7.16 
## 20 Bulgaria                    2.46   0.584                    1.77  4.31 
## # ℹ 25 more variables: Milk...Excluding.Butter <dbl>, Offals <dbl>,
## #   Oilcrops <dbl>, Spices <dbl>, Vegetal.Products <dbl>, Vegetable.Oils <dbl>,
## #   Vegetables <dbl>, Obesity <dbl>, Undernourished <chr>, Confirmed <dbl>,
## #   Deaths <dbl>, Recovered <dbl>, Active <dbl>, Population <dbl>,
## #   Unit.for.FoodCategories.NutritionStatus.HealthRates <chr>,
## #   Fats.and.Oils <dbl>, SugarCrops.and.Sweeteners <dbl>,
## #   Vegetables.and.products <dbl>, Fish.Seafood.and.Products <dbl>, …

#Dietary Diversity Score Calculation

columns_to_count <- c("Eggs", "Fruits...Excluding.Wine", "Milk...Excluding.Butter", "SugarCrops.and.Sweeteners", "Fats.and.Oils", "Vegetables.and.products", "Meat.and.Products", "Grains", "Legumes.and.Nuts", "Fish.Seafood.and.Products")               
colnames (covid_diet_data_unique)
##  [1] "Country"                                            
##  [2] "Animal.fats"                                        
##  [3] "Eggs"                                               
##  [4] "Fruits...Excluding.Wine"                            
##  [5] "Meat"                                               
##  [6] "Milk...Excluding.Butter"                            
##  [7] "Offals"                                             
##  [8] "Oilcrops"                                           
##  [9] "Spices"                                             
## [10] "Vegetal.Products"                                   
## [11] "Vegetable.Oils"                                     
## [12] "Vegetables"                                         
## [13] "Obesity"                                            
## [14] "Undernourished"                                     
## [15] "Confirmed"                                          
## [16] "Deaths"                                             
## [17] "Recovered"                                          
## [18] "Active"                                             
## [19] "Population"                                         
## [20] "Unit.for.FoodCategories.NutritionStatus.HealthRates"
## [21] "Fats.and.Oils"                                      
## [22] "SugarCrops.and.Sweeteners"                          
## [23] "Vegetables.and.products"                            
## [24] "Fish.Seafood.and.Products"                          
## [25] "Meat.and.Products"                                  
## [26] "Grains"                                             
## [27] "Legumes.and.Nuts"                                   
## [28] "MortalityRate"                                      
## [29] "MorbidityRate"                                      
## [30] "RecoveryRate"
covid_diet_data_unique$Dietary.Diversity.Score <- apply(covid_diet_data_unique[, columns_to_count], 
                                                         1, 
                                                         function(x) sum(x >= 0.05))

#created  a function to count only the values not less than 0.05 or 5 % as values below this would not have a significant contribution to a population's Dietary Intake. 
# Display the updated data frame
print(as_tibble(head(covid_diet_data_unique, 20)))
## # A tibble: 20 × 31
##    Country                Animal.fats   Eggs Fruits...Excluding.Wine  Meat
##    <chr>                        <dbl>  <dbl>                   <dbl> <dbl>
##  1 Afghanistan                 0.850  0.150                    1.48  1.20 
##  2 Albania                     1.06   0.809                    3.90  3.87 
##  3 Algeria                     0.194  0.418                    3.18  1.25 
##  4 Angola                      0.264  0.0441                   2.31  2.93 
##  5 Argentina                   1.06   0.864                    1.47  9.45 
##  6 Armenia                     1.77   0.731                    2.53  4.22 
##  7 Australia                   1.90   0.468                    1.66  7.49 
##  8 Austria                     5.25   0.785                    1.60  5.01 
##  9 Azerbaijan                  1.30   0.548                    1.61  2.93 
## 10 Bangladesh                  0.154  0.231                    0.655 0.347
## 11 Barbados                    1.16   0.587                    1.93  5.66 
## 12 Belarus                     2.67   0.851                    1.40  5.71 
## 13 Belgium                     4.78   0.69                     1.38  3.28 
## 14 Belize                      2.61   0.297                    2.52  3.95 
## 15 Benin                       0.0907 0.0544                   0.762 1.20 
## 16 Bolivia                     0.913  0.552                    2.42  6.75 
## 17 Bosnia and Herzegovina      0.551  0.291                    1.90  3.03 
## 18 Botswana                    1.05   0.107                    1.03  1.88 
## 19 Brazil                      1.52   0.446                    1.72  7.16 
## 20 Bulgaria                    2.46   0.584                    1.77  4.31 
## # ℹ 26 more variables: Milk...Excluding.Butter <dbl>, Offals <dbl>,
## #   Oilcrops <dbl>, Spices <dbl>, Vegetal.Products <dbl>, Vegetable.Oils <dbl>,
## #   Vegetables <dbl>, Obesity <dbl>, Undernourished <chr>, Confirmed <dbl>,
## #   Deaths <dbl>, Recovered <dbl>, Active <dbl>, Population <dbl>,
## #   Unit.for.FoodCategories.NutritionStatus.HealthRates <chr>,
## #   Fats.and.Oils <dbl>, SugarCrops.and.Sweeteners <dbl>,
## #   Vegetables.and.products <dbl>, Fish.Seafood.and.Products <dbl>, …
desired_column_order <- c( "Country", "Eggs", "Fats.and.Oils",  "Fish.Seafood.and.Products", 
"Fruits...Excluding.Wine", "Grains", "Legumes.and.Nuts", "Meat.and.Products", 
"Milk...Excluding.Butter", "SugarCrops.and.Sweeteners", "Vegetables.and.products", 
"Dietary.Diversity.Score", "Obesity", "Undernourished",
"Population", "Confirmed", 
"Deaths", "Recovered", "Active", "MortalityRate", "MorbidityRate", "RecoveryRate",  "Unit.for.FoodCategories.NutritionStatus.HealthRates")

covid_diet_data_unique <- covid_diet_data_unique[, desired_column_order]


head(covid_diet_data_unique)
##       Country   Eggs Fats.and.Oils Fish.Seafood.and.Products
## 1 Afghanistan 0.1501        3.3267                    0.0000
## 2     Albania 0.8091        4.9721                    0.1471
## 3     Algeria 0.4181        6.2267                    0.1195
## 4      Angola 0.0441        5.6180                    0.8372
## 6   Argentina 0.8643        6.6369                    0.2006
## 7     Armenia 0.7310        5.5717                    0.1787
##   Fruits...Excluding.Wine  Grains Legumes.and.Nuts Meat.and.Products
## 1                  1.4757 37.4438           0.6254            6.1031
## 2                  3.8982 17.4758           1.2063           20.2266
## 3                  3.1805 26.9374           1.3140            7.3466
## 4                  2.3133 30.9760           1.4981            7.7331
## 6                  1.4663 18.1972           0.1698           24.6952
## 7                  2.5341 20.5166           0.7472           17.3489
##   Milk...Excluding.Butter SugarCrops.and.Sweeteners Vegetables.and.products
## 1                  2.4512                    2.2261                 45.9980
## 2                  9.9441                    3.4422                 36.6578
## 3                  3.9869                    3.9869                 46.0206
## 4                  0.5067                    2.7539                 45.6709
## 6                  3.1641                    7.0536                 35.8543
## 7                  5.6368                    5.2956                 40.3834
##   Dietary.Diversity.Score Obesity Undernourished Population Confirmed Deaths
## 1                       9     4.5           29.8   38928000        14      1
## 2                      10    22.3            6.2    2838000       297      5
## 3                      10    26.6            3.9   44357000        24      1
## 4                       9     6.8             25   32522000         6      0
## 6                      10    28.5            4.6   45377000       436     11
## 7                      10    20.9            4.3    2956000       568     11
##   Recovered Active MortalityRate MorbidityRate RecoveryRate
## 1        12      1      7.142857 0.00003596383     85.71429
## 2       179    112      1.683502 0.01046511628     60.26936
## 3        17      7      4.166667 0.00005410645     70.83333
## 4         6      0      0.000000 0.00001844905    100.00000
## 6       391     34      2.522936 0.00096083919     89.67890
## 7       540     18      1.936620 0.01921515562     95.07042
##   Unit.for.FoodCategories.NutritionStatus.HealthRates
## 1                                                   %
## 2                                                   %
## 3                                                   %
## 4                                                   %
## 6                                                   %
## 7                                                   %

Data Visualization

Note: Setting the data frames for demographic plots. I chose to focus on the countries with the Lowest Mortality and Morbidity rate, and countries with the Highest Recovery rates to examine the food categories potentially influencing these Health Rate types.

##COVID 19 Demographics

mortality_data <- covid_diet_data_unique %>%
  arrange(MortalityRate) %>%
  head(5) %>%
  mutate(RateType = "MortalityRate")

print(mortality_data)
##        Country   Eggs Fats.and.Oils Fish.Seafood.and.Products
## 1       Angola 0.0441        5.6180                    0.8372
## 2    Australia 0.4681       10.9484                    0.6040
## 3   Bangladesh 0.2312        3.7179                    0.8284
## 4        Benin 0.0544        6.6061                    0.5263
## 5 Burkina Faso 0.1471        8.0161                    0.2574
##   Fruits...Excluding.Wine  Grains Legumes.and.Nuts Meat.and.Products
## 1                  2.3133 30.9760           1.4981            7.7331
## 2                  1.6611 12.9568           0.9816           23.4521
## 3                  0.6550 39.4529           1.3485            2.7548
## 4                  0.7623 32.9401           2.1597            3.7568
## 5                  0.1471 32.0831           2.5004            4.0448
##   Milk...Excluding.Butter SugarCrops.and.Sweeteners Vegetables.and.products
## 1                  0.5067                    2.7539                 45.6709
## 2                  4.8022                    5.7989                 35.5180
## 3                  0.7706                    1.4448                 48.2566
## 4                  0.5263                    1.4338                 48.3848
## 5                  1.0112                    1.7650                 47.3984
##   Dietary.Diversity.Score Obesity Undernourished Population Confirmed Deaths
## 1                       9     6.8             25   32522000         6      0
## 2                      10    30.4           <2.5   25754000        11      0
## 3                      10     3.4           14.7  169809000        32      0
## 4                      10     8.2           10.1   12209000         3      0
## 5                      10     4.5             20   20903000         5      0
##   Recovered Active MortalityRate MorbidityRate RecoveryRate
## 1         6      0             0 0.00001844905    100.00000
## 2        10      1             0 0.00004271181     90.90909
## 3        28      3             0 0.00001884470     87.50000
## 4         3      0             0 0.00002457204    100.00000
## 5         5      1             0 0.00002392001    100.00000
##   Unit.for.FoodCategories.NutritionStatus.HealthRates      RateType
## 1                                                   % MortalityRate
## 2                                                   % MortalityRate
## 3                                                   % MortalityRate
## 4                                                   % MortalityRate
## 5                                                   % MortalityRate
morbidity_data <- covid_diet_data_unique %>%
  arrange(MorbidityRate) %>%
  head(5) %>%
  mutate(RateType = "MorbidityRate")

print(morbidity_data)
##    Country   Eggs Fats.and.Oils Fish.Seafood.and.Products
## 1    China 1.2349        5.8082                    1.3081
## 2    Yemen 0.1455        4.4606                    0.1697
## 3  Nigeria 0.1624        6.7181                    0.3450
## 4    India 0.2384        6.8137                    0.2582
## 5 Thailand 0.9020        5.7304                    1.1496
##   Fruits...Excluding.Wine  Grains Legumes.and.Nuts Meat.and.Products
## 1                  1.2924 18.7850           0.9524           26.7438
## 2                  1.1879 32.3879           1.2363            5.6000
## 3                  1.4410 33.8543           2.1514            2.3544
## 4                  1.4303 28.7644           3.3373            5.8801
## 5                  1.8394 24.2483           0.5306            9.5507
##   Milk...Excluding.Butter SugarCrops.and.Sweeteners Vegetables.and.products
## 1                  1.8890                    3.3488                 36.2880
## 2                  0.6545                    7.0303                 46.9091
## 3                  0.2233                    1.6034                 49.4824
## 4                  3.2578                    3.5757                 45.5701
## 5                  0.8490                    7.7290                 44.1812
##   Dietary.Diversity.Score Obesity Undernourished Population Confirmed Deaths
## 1                      10     6.6            8.5 1402385000         1      0
## 2                      10    14.1           38.9   29826000         1      0
## 3                      10     7.8           13.4  206140000         7      0
## 4                      10     3.8           14.5 1400100000        77      1
## 5                      10    10.8            7.8   66534000         4      0
##   Recovered Active MortalityRate    MorbidityRate RecoveryRate
## 1         1      0      0.000000 0.00000007130709    100.00000
## 2         0      0      0.000000 0.00000335277945      0.00000
## 3         5      1      0.000000 0.00000339575046     71.42857
## 4        75      1      1.298701 0.00000549960717     97.40260
## 5         3      1      0.000000 0.00000601196381     75.00000
##   Unit.for.FoodCategories.NutritionStatus.HealthRates      RateType
## 1                                                   % MorbidityRate
## 2                                                   % MorbidityRate
## 3                                                   % MorbidityRate
## 4                                                   % MorbidityRate
## 5                                                   % MorbidityRate
recovery_data <- covid_diet_data_unique %>%
  arrange(desc(RecoveryRate)) %>%
  head(5) %>%
  mutate(RateType = "RecoveryRate")

print(recovery_data)
##                    Country   Eggs Fats.and.Oils Fish.Seafood.and.Products
## 1                   Angola 0.0441        5.6180                    0.8372
## 2                    Benin 0.0544        6.6061                    0.5263
## 3             Burkina Faso 0.1471        8.0161                    0.2574
## 4 Central African Republic 0.0569        7.8476                    0.4265
## 5                     Chad 0.0239        8.1379                    0.4787
##   Fruits...Excluding.Wine  Grains Legumes.and.Nuts Meat.and.Products
## 1                  2.3133 30.9760           1.4981            7.7331
## 2                  0.7623 32.9401           2.1597            3.7568
## 3                  0.1471 32.0831           2.5004            4.0448
## 4                  1.9050 28.6324           2.2747           12.7097
## 5                  0.3112 30.9957           2.0345           10.5553
##   Milk...Excluding.Butter SugarCrops.and.Sweeteners Vegetables.and.products
## 1                  0.5067                    2.7539                 45.6709
## 2                  0.5263                    1.4338                 48.3848
## 3                  1.0112                    1.7650                 47.3984
## 4                  0.8814                    1.7060                 42.9059
## 5                  2.0345                    2.0823                 43.1785
##   Dietary.Diversity.Score Obesity Undernourished Population Confirmed Deaths
## 1                       9     6.8             25   32522000         6      0
## 2                      10     8.2           10.1   12209000         3      0
## 3                      10     4.5             20   20903000         5      0
## 4                      10     6.3           59.6    4830000        10      0
## 5                       9     4.8           37.5   16877000         2      0
##   Recovered Active MortalityRate MorbidityRate RecoveryRate
## 1         6      0             0 0.00001844905          100
## 2         3      0             0 0.00002457204          100
## 3         5      1             0 0.00002392001          100
## 4        10      0             0 0.00020703934          100
## 5         2      0             0 0.00001185045          100
##   Unit.for.FoodCategories.NutritionStatus.HealthRates     RateType
## 1                                                   % RecoveryRate
## 2                                                   % RecoveryRate
## 3                                                   % RecoveryRate
## 4                                                   % RecoveryRate
## 5                                                   % RecoveryRate
mortality_plot <- ggplot(mortality_data, aes(x = reorder(Country, -MortalityRate), y = MortalityRate, 
                                             fill = "MortalityRate")) +
  geom_bar(stat = "identity", show.legend = FALSE) +
  scale_fill_manual(values = c("MortalityRate" = 
                                 "#ADD8E6")) +
  labs(title = "Lowest Mortality Rates by Country", x = "Country", y = "Mortality Rate") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust 
                                   = 1))

#rounded up the Top 5 Countries with the lowest Mortality Rate 
# Morbidity Rate Plot
morbidity_plot <- ggplot(morbidity_data, aes(x = reorder(Country, -MorbidityRate), y = MorbidityRate, 
                                             fill = "MorbidityRate")) +
  geom_bar(stat = "identity", show.legend = FALSE) +
  scale_fill_manual(values = c("MorbidityRate" = 
                                 "pink")) +
  labs(title = "Lowest Morbidity Rates by Country", 
       x = "Country", y = "Morbidity Rate") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust 
                                   = 1))
#rounded up the Top 5 Countries with the lowest Morbdidity Rate 
# Recovery Rate Plot
recovery_plot <- ggplot(recovery_data, aes(x = reorder(Country, -RecoveryRate), y = RecoveryRate, 
                                           fill = "RecoveryRate")) +
  geom_bar(stat = "identity", show.legend = FALSE) +
  scale_fill_manual(values = c("RecoveryRate" = 
                                 "purple")) +
  labs(title = "Highest Recovery Rates by Country", 
       x = "Country", y = "Recovery Rate") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, 
                                   hjust = 1))
#rounded up the Top 5 Countries with the highest Recovery Rate 
# Save Mortality Rate Plot
ggsave("images/mortality_rate_plot.png", plot = mortality_plot, width = 8, height = 6)
Plot 1
Plot 1

Analysis: The top 5 Low Mortality Rate Countries with all recorded 0% Mortality Rate. It can be observed that most of the countries originated from Africa with the exception of Australia and Bangladesh.

# Save Morbidity Rate Plot
ggsave("images/morbidity_rate_plot.png", plot = morbidity_plot, width = 8, height = 6)
Plot 2
Plot 2

Analysis: the Top 5 Countries with the lowest Morbidity Rate recorded values between 0.0000 - 0.0006 %. It can be observed that this group consists primarily of Asian countries with the exception of Yemen and Nigeria.

# Save Recovery Rate Plot
ggsave("images/recovery_rate_plot.png", plot = recovery_plot, width = 8, height = 6)
Plot 3
Plot 3

Analysis: The Top 5 Countries with the Highest Recovery Rate consists of African countries. Recording Recovery Rate values of 100%.

##Food Consumption Data

Note: the focus of this area was to ranking the top 5 most consumed Food Categories for the Lowest Mortality, Lowest Morbidity Rate and Highest Recovery Rate countries

food_columns <- c("Eggs", "Fats.and.Oils", "Fish.Seafood.and.Products", 
                  "Fruits...Excluding.Wine", "Grains", "Legumes.and.Nuts", 
                  "Meat.and.Products", "Milk...Excluding.Butter", 
                  "SugarCrops.and.Sweeteners", "Vegetables.and.products")

# Reshape the data for mortality_data to long format for plotting
mortality_long <- mortality_data %>%
  select(Country, food_columns) %>%  # Select the relevant columns
  gather(key = "FoodCategory", value = "Consumption", -Country) %>%  # Convert from wide to long format
  arrange(desc(Consumption)) %>%  # Sort by Consumption in descending order
  group_by(Country) %>%  # Group by Country
  slice_head(n = 5) %>%  # Get the top 5 highest food categories for each country
  ungroup()  # Ungroup after slicing
## Warning: Using an external vector in selections was deprecated in tidyselect 1.1.0.
## ℹ Please use `all_of()` or `any_of()` instead.
##   # Was:
##   data %>% select(food_columns)
## 
##   # Now:
##   data %>% select(all_of(food_columns))
## 
## See <https://tidyselect.r-lib.org/reference/faq-external-vector.html>.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
print(mortality_long)
## # A tibble: 25 × 3
##    Country   FoodCategory              Consumption
##    <chr>     <chr>                           <dbl>
##  1 Angola    Vegetables.and.products         45.7 
##  2 Angola    Grains                          31.0 
##  3 Angola    Meat.and.Products                7.73
##  4 Angola    Fats.and.Oils                    5.62
##  5 Angola    SugarCrops.and.Sweeteners        2.75
##  6 Australia Vegetables.and.products         35.5 
##  7 Australia Meat.and.Products               23.5 
##  8 Australia Grains                          13.0 
##  9 Australia Fats.and.Oils                   10.9 
## 10 Australia SugarCrops.and.Sweeteners        5.80
## # ℹ 15 more rows
# Create the facet-wrapped bar plot
food_mortality_plot <- ggplot(mortality_long, aes(x = reorder(FoodCategory, Consumption), y = 
Consumption, fill = FoodCategory)) +
  geom_bar(stat = "identity", width = 0.7) +  # Bar plot for the consumption values
  facet_wrap(~ Country, scales = "free_y") +  # Facet by Country with free y-axis scales
  labs(title = "Top Food Category Consumption of Low Mortality Countries",
       x = "Food Category",
       y = "Consumption") +
  theme_minimal() +
  theme(
    legend.position = "none",  # Hide the legend
    strip.text.x = element_text(size = 8.5),  # Adjust facet label size
    axis.text.x = element_text(angle = 45, hjust = 1)  # Tilt x-axis labels for readability
  )

ggsave("images/food_mortality_plot.png", plot = food_mortality_plot, width = 10, height = 6, dpi = 300, 
       device = "png")
Plot 4
Plot 4

Analysis:

Among the Lowest Mortality Rate Countries, the primary Food Category that comprises the populations diet were Vegetables/Vegetable Products and Grains comprising between 38.5-45.5% and 12.9-39.4% respectively. Meat and Meat products came in fourth comprising 2.7% -23.4%, Fats and Oils comprising between 3.7-10.9%.

food_columns <- c("Eggs", "Fats.and.Oils", "Fish.Seafood.and.Products", 
                  "Fruits...Excluding.Wine", "Grains", "Legumes.and.Nuts", 
                  "Meat.and.Products", "Milk...Excluding.Butter", 
                  "SugarCrops.and.Sweeteners", "Vegetables.and.products")

# Reshape the data for mortality_data to long format for plotting
morbidity_long <- morbidity_data %>%
  select(Country, food_columns) %>%  # Select the relevant columns
  gather(key = "FoodCategory", value = "Consumption", -Country) %>%  # Convert from wide to long format
  arrange(desc(Consumption)) %>%  # Sort by Consumption in descending order
  group_by(Country) %>%  # Group by Country
  slice_head(n = 5) %>%  # Get the top 5 highest food categories for each country
  ungroup()  # Ungroup after slicing

print(morbidity_long)
## # A tibble: 25 × 3
##    Country FoodCategory              Consumption
##    <chr>   <chr>                           <dbl>
##  1 China   Vegetables.and.products         36.3 
##  2 China   Meat.and.Products               26.7 
##  3 China   Grains                          18.8 
##  4 China   Fats.and.Oils                    5.81
##  5 China   SugarCrops.and.Sweeteners        3.35
##  6 India   Vegetables.and.products         45.6 
##  7 India   Grains                          28.8 
##  8 India   Fats.and.Oils                    6.81
##  9 India   Meat.and.Products                5.88
## 10 India   SugarCrops.and.Sweeteners        3.58
## # ℹ 15 more rows
# Create the facet-wrapped bar plot
food_morbidity_plot <- ggplot(morbidity_long, aes(x = reorder(FoodCategory, Consumption), y = 
 Consumption, fill = FoodCategory)) +
  geom_bar(stat = "identity", width = 0.7) +  # Bar plot for the consumption values
  facet_wrap(~ Country, scales = "free_y") +  # Facet by Country with free y-axis scales
  labs(title = "Top Food Category Consumption of Low Morbidity Countries",
       x = "Food Category",
       y = "Consumption") +
  theme_minimal() +
  theme(
    legend.position = "none",  # Hide the legend
    strip.text.x = element_text(size = 8.5),  # Adjust facet label size
    axis.text.x = element_text(angle = 45, hjust = 1)  # Tilt x-axis labels for readability
  )


ggsave("images/food_morbidity_plot.png", plot = food_morbidity_plot, width = 10, height = 6, dpi = 300, 
       device = "png")
Plot 5
Plot 5

Analysis: Among the Lowest Morbidity Rate Countries, the primary Food Category that comprises the populations diet were Vegetables/Vegetable Products and Grains comprising between 36.2-49.5% and 18.7-33.8% respectively. Meat and Meat products comprising 2.4 - 26.7%. This was followed by Fats and oil ranging between 4.4 -6.8%.

# Define the food category columns
food_columns <- c("Eggs", "Fats.and.Oils", "Fish.Seafood.and.Products", 
                  "Fruits...Excluding.Wine", "Grains", "Legumes.and.Nuts", 
                  "Meat.and.Products", "Milk...Excluding.Butter", 
                  "SugarCrops.and.Sweeteners", "Vegetables.and.products")

# Reshape the data for mortality_data to long format for plotting
recovery_long <- recovery_data %>%
  select(Country, food_columns) %>%  # Select the relevant columns
  gather(key = "FoodCategory", value = "Consumption", -Country) %>%  # Convert from wide to long format
  arrange(desc(Consumption)) %>%  # Sort by Consumption in descending order
  group_by(Country) %>%  # Group by Country
  slice_head(n = 5) %>%  # Get the top 5 highest food categories for each country
  ungroup()  # Ungroup after slicing

print(recovery_long)
## # A tibble: 25 × 3
##    Country FoodCategory              Consumption
##    <chr>   <chr>                           <dbl>
##  1 Angola  Vegetables.and.products         45.7 
##  2 Angola  Grains                          31.0 
##  3 Angola  Meat.and.Products                7.73
##  4 Angola  Fats.and.Oils                    5.62
##  5 Angola  SugarCrops.and.Sweeteners        2.75
##  6 Benin   Vegetables.and.products         48.4 
##  7 Benin   Grains                          32.9 
##  8 Benin   Fats.and.Oils                    6.61
##  9 Benin   Meat.and.Products                3.76
## 10 Benin   Legumes.and.Nuts                 2.16
## # ℹ 15 more rows
# Create the facet-wrapped bar plot
food_recovery_plot <- ggplot(recovery_long, aes(x = reorder(FoodCategory, Consumption), y = 
Consumption, fill = FoodCategory)) +
  geom_bar(stat = "identity", width = 0.7) +  # Bar plot for the consumption values
  facet_wrap(~ Country, scales = "free_y") +  # Facet by Country with free y-axis scales
  labs(title = "Top Food Category Consumption of High Recovery 
    Rate Countries",
       x = "Food Category",
       y = "Consumption") +
  theme_minimal() +
  theme(
    legend.position = "none",  # Hide the legend
    strip.text.x = element_text(size = 8.5),  # Adjust facet label size
    axis.text.x = element_text(angle = 45, hjust = 1)  # Tilt x-axis labels for readability
  )


ggsave("images/food_recovery_plot.png", plot = food_recovery_plot, width = 10, height = 6, dpi = 300, 
       device = "png")
Plot 6
Plot 6

Analysis: Among the High Recovery Rate Countries, the primary Food Category that comprises the populations diet were Vegetables/Vegetable Products and Grains comprising between 48.4-43.9% and 28.6-32.9% respectively. Meat and Meat products comprising 3.7 - 12.7%. This was followed by Fats and oil ranging between 5.6 -8.1%.

##Dietary Diversity Score

note: this area explored the correlation between the Dietary Diversity Score and COVID 19 health outcomes in Low Mortality Rate Countries, Low Morbidity Rate Countries and High Recovery Rate Countries.

mortality_data <- covid_diet_data_unique %>%
  arrange(MortalityRate) %>%
  head(5) %>%
  mutate(RateType = "LowMortalityRate")

morbidity_data <- covid_diet_data_unique %>%
  arrange(MorbidityRate) %>%
  head(5) %>%
  mutate(RateType = "LowMorbidityRate")

recovery_data <- covid_diet_data_unique %>%
  arrange(desc(RecoveryRate)) %>%
  head(5) %>%
  mutate(RateType = "HighRecoveryRate")

# Combine the datasets into one and arrange by country in alphabetical order
combined_data <- bind_rows(
  mortality_data,
  morbidity_data,
  recovery_data
) %>%
  arrange(Country)  # Sort by Country alphabetically

print(combined_data)
##                     Country   Eggs Fats.and.Oils Fish.Seafood.and.Products
## 1                    Angola 0.0441        5.6180                    0.8372
## 2                    Angola 0.0441        5.6180                    0.8372
## 3                 Australia 0.4681       10.9484                    0.6040
## 4                Bangladesh 0.2312        3.7179                    0.8284
## 5                     Benin 0.0544        6.6061                    0.5263
## 6                     Benin 0.0544        6.6061                    0.5263
## 7              Burkina Faso 0.1471        8.0161                    0.2574
## 8              Burkina Faso 0.1471        8.0161                    0.2574
## 9  Central African Republic 0.0569        7.8476                    0.4265
## 10                     Chad 0.0239        8.1379                    0.4787
## 11                    China 1.2349        5.8082                    1.3081
## 12                    India 0.2384        6.8137                    0.2582
## 13                  Nigeria 0.1624        6.7181                    0.3450
## 14                 Thailand 0.9020        5.7304                    1.1496
## 15                    Yemen 0.1455        4.4606                    0.1697
##    Fruits...Excluding.Wine  Grains Legumes.and.Nuts Meat.and.Products
## 1                   2.3133 30.9760           1.4981            7.7331
## 2                   2.3133 30.9760           1.4981            7.7331
## 3                   1.6611 12.9568           0.9816           23.4521
## 4                   0.6550 39.4529           1.3485            2.7548
## 5                   0.7623 32.9401           2.1597            3.7568
## 6                   0.7623 32.9401           2.1597            3.7568
## 7                   0.1471 32.0831           2.5004            4.0448
## 8                   0.1471 32.0831           2.5004            4.0448
## 9                   1.9050 28.6324           2.2747           12.7097
## 10                  0.3112 30.9957           2.0345           10.5553
## 11                  1.2924 18.7850           0.9524           26.7438
## 12                  1.4303 28.7644           3.3373            5.8801
## 13                  1.4410 33.8543           2.1514            2.3544
## 14                  1.8394 24.2483           0.5306            9.5507
## 15                  1.1879 32.3879           1.2363            5.6000
##    Milk...Excluding.Butter SugarCrops.and.Sweeteners Vegetables.and.products
## 1                   0.5067                    2.7539                 45.6709
## 2                   0.5067                    2.7539                 45.6709
## 3                   4.8022                    5.7989                 35.5180
## 4                   0.7706                    1.4448                 48.2566
## 5                   0.5263                    1.4338                 48.3848
## 6                   0.5263                    1.4338                 48.3848
## 7                   1.0112                    1.7650                 47.3984
## 8                   1.0112                    1.7650                 47.3984
## 9                   0.8814                    1.7060                 42.9059
## 10                  2.0345                    2.0823                 43.1785
## 11                  1.8890                    3.3488                 36.2880
## 12                  3.2578                    3.5757                 45.5701
## 13                  0.2233                    1.6034                 49.4824
## 14                  0.8490                    7.7290                 44.1812
## 15                  0.6545                    7.0303                 46.9091
##    Dietary.Diversity.Score Obesity Undernourished Population Confirmed Deaths
## 1                        9     6.8             25   32522000         6      0
## 2                        9     6.8             25   32522000         6      0
## 3                       10    30.4           <2.5   25754000        11      0
## 4                       10     3.4           14.7  169809000        32      0
## 5                       10     8.2           10.1   12209000         3      0
## 6                       10     8.2           10.1   12209000         3      0
## 7                       10     4.5             20   20903000         5      0
## 8                       10     4.5             20   20903000         5      0
## 9                       10     6.3           59.6    4830000        10      0
## 10                       9     4.8           37.5   16877000         2      0
## 11                      10     6.6            8.5 1402385000         1      0
## 12                      10     3.8           14.5 1400100000        77      1
## 13                      10     7.8           13.4  206140000         7      0
## 14                      10    10.8            7.8   66534000         4      0
## 15                      10    14.1           38.9   29826000         1      0
##    Recovered Active MortalityRate    MorbidityRate RecoveryRate
## 1          6      0      0.000000 0.00001844904987    100.00000
## 2          6      0      0.000000 0.00001844904987    100.00000
## 3         10      1      0.000000 0.00004271181176     90.90909
## 4         28      3      0.000000 0.00001884470199     87.50000
## 5          3      0      0.000000 0.00002457203702    100.00000
## 6          3      0      0.000000 0.00002457203702    100.00000
## 7          5      1      0.000000 0.00002392001148    100.00000
## 8          5      1      0.000000 0.00002392001148    100.00000
## 9         10      0      0.000000 0.00020703933747    100.00000
## 10         2      0      0.000000 0.00001185044735    100.00000
## 11         1      0      0.000000 0.00000007130709    100.00000
## 12        75      1      1.298701 0.00000549960717     97.40260
## 13         5      1      0.000000 0.00000339575046     71.42857
## 14         3      1      0.000000 0.00000601196381     75.00000
## 15         0      0      0.000000 0.00000335277945      0.00000
##    Unit.for.FoodCategories.NutritionStatus.HealthRates         RateType
## 1                                                    % LowMortalityRate
## 2                                                    % HighRecoveryRate
## 3                                                    % LowMortalityRate
## 4                                                    % LowMortalityRate
## 5                                                    % LowMortalityRate
## 6                                                    % HighRecoveryRate
## 7                                                    % LowMortalityRate
## 8                                                    % HighRecoveryRate
## 9                                                    % HighRecoveryRate
## 10                                                   % HighRecoveryRate
## 11                                                   % LowMorbidityRate
## 12                                                   % LowMorbidityRate
## 13                                                   % LowMorbidityRate
## 14                                                   % LowMorbidityRate
## 15                                                   % LowMorbidityRate
#Distribution of DDS values
Dietary_Diversity_Score_Plot <- ggplot(combined_data, aes(x = Country, y = 
                                                            Dietary.Diversity.Score, color = RateType)) +
  geom_point(size = 3) +  # Plot individual points with size 3
  labs(title = "Dietary Diversity Score by Country", 
       x = "Country", 
       y = "Dietary Diversity Score") +
  theme_minimal() +
  theme(
    axis.text.x = element_text(angle = 90, hjust = 1),  # Rotate x-axis labels for readability
    legend.position = "top"  # Place the legend at the top for better visibility
  ) +
  scale_y_continuous(breaks = c(9, 10))  # Set y-axis to display only 9 and 10
ggsave("images/Dietary_Diversity_Score_Plot.png", plot = Dietary_Diversity_Score_Plot, width = 10, height = 6, dpi = 300, device = "png")
Plot 7
Plot 7

Analysis: By observing the Dot Plot, It can be deduced that a Dietary Diversity Score not lower than 9, is positively associated with better COVID 19 health outcomes. It shows that a Dietary Diversity Score of 9 could aid in the Recovery process. Meanwhile, a Dietary Diversity Score of 10 could prevent infection with the virus, improve recovery and potentially increase survival.

This could suggest that consuming a wider variety of food groups contributes to improved Nutritional Status which might increase protection, boost recovery and potentially increases the chances of survival from the virus.

Analysis Summary

Demographic Distribution

It can be observed that countries belonging to the categories of Lowest Mortality Rate, Low Morbidity Rate and High Recovery Rates are are predominantly from Asia and Africa. This reveals that geographic and demographic patterns that shape health outcomes. With African countries leading in Recovery Rates and Asian countries primarily constituting a great portion of Lowest Mortality Rates. This could suggest that Population density plays a role in these trends but varies widely across the regions.

It is important to note that factors such as the accuracy of COVID-19 case reporting and a country’s capacity for large-scale testing may influence the data and affect the reliability of the statistics.

Food Consumption

The vegetable/vegetable product and grain proportions in the diets of the countries belonging to the respective categories Lowest Mortality Rate, Lowest Morbidity Rates and Highest Recovery Rate countries are in line with WHO recommendations for a balanced and healthy diet. Their relatively low meat consumption aligns with WHO’s guidance to limit red and processed meats. Meanwhile their Fats and oils consumption also fall fit under general recommendations,but the types of fats consumed must be considered for a more comprehensive comparison. Overall, these dietary trends contribute to lower morbidity rates and reflect a generally healthy, plant-based approach to nutrition.

Dietary Diversity Score

A score of 9 appears to support the recovery process, while a score of 10 may help prevent infection, enhance recovery, and potentially improve survival rates.

This suggests that consuming a broader range of food groups contributes to improved Nutritional Status which might increase protection, boost recovery and potentially increases the chances of survival from the virus.