Task - Choose one of the provided datasets on fivethirtyeight.com that you find interesting: https://data.fivethirtyeight.com/

You should first study the data and any other information on the GitHub site, and read the associated fivethirtyeight.com article.

To receive full credit, you should: 1. Take the data, and create one or more code blocks. You should finish with a data frame that contains a subset of the columns in your selected dataset. If there is an obvious target (aka predictor or independent) variable, you should include this in your set of columns. You should include (or add if necessary) meaningful column names and replace (if necessary) any non-intuitive abbreviations used in the data that you selected. For example, if you had instead been tasked with working with the UCI mushroom dataset, you would include the target column for edible or poisonous, and transform “e” values to “edible.” Your deliverable is the R code to perform these transformation tasks.

  1. Make sure that the original data file is accessible through your code—for example, stored in a GitHub repository or AWS S3 bucket and referenced in your code. If the code references data on your local machine, then your work is not reproducible!

  2. Start your R Markdown document with a two to three sentence “Overview” or “Introduction” description of what the article that you chose is about, and include a link to the article.

  3. Finish with a “Conclusions” or “Findings and Recommendations” text block that includes what you might do to extend, verify, or update the work from the selected article.

  4. Each of your text blocks should minimally include at least one header, and additional non-header text.

  5. You’re of course welcome—but not required–to include additional information, such as exploratory data analysis graphics (which we will cover later in the course).

  6. Place your solution into a single R Markdown (.Rmd) file and publish your solution out to rpubs.com.

  7. Post the .Rmd file in your GitHub repository, and provide the appropriate URLs to your GitHub repositor y and your rpubs.com file in your assignment link.

OVERVIEW The Data I will be working with for this assignment compare the comsuption of wine, beer and other spirits of different countries across the world. A row is listed for each country along with the amount of each alcoholic beverage.

The dataset was taken from: https://fivethirtyeight.com/features/dear-mona-followup-where-do-people-drink-the-most-beer-wine-and-spirits//

## Load data from GitHub

AlcoholConsumptionData = read.table(file="https://raw.githubusercontent.com/BeshkiaKvarnstrom/MSDS-DATA607/main/drinks.csv", header=TRUE,sep=",")
# Reading the data in the Dataframe
AlcoholConsum <- data.frame(AlcoholConsumptionData$country, AlcoholConsumptionData$beer_servings, AlcoholConsumptionData$spirit_servings, AlcoholConsumptionData$wine_servings, AlcoholConsumptionData$total_litres_of_pure_alcohol)

colnames(AlcoholConsum) <- c("COUNTRY", "BEER", "SPIRIT", "WINE", "TOTAL LITRES")

AlcoholConsum
##                          COUNTRY BEER SPIRIT WINE TOTAL LITRES
## 1                    Afghanistan    0      0    0          0.0
## 2                        Albania   89    132   54          4.9
## 3                        Algeria   25      0   14          0.7
## 4                        Andorra  245    138  312         12.4
## 5                         Angola  217     57   45          5.9
## 6              Antigua & Barbuda  102    128   45          4.9
## 7                      Argentina  193     25  221          8.3
## 8                        Armenia   21    179   11          3.8
## 9                      Australia  261     72  212         10.4
## 10                       Austria  279     75  191          9.7
## 11                    Azerbaijan   21     46    5          1.3
## 12                       Bahamas  122    176   51          6.3
## 13                       Bahrain   42     63    7          2.0
## 14                    Bangladesh    0      0    0          0.0
## 15                      Barbados  143    173   36          6.3
## 16                       Belarus  142    373   42         14.4
## 17                       Belgium  295     84  212         10.5
## 18                        Belize  263    114    8          6.8
## 19                         Benin   34      4   13          1.1
## 20                        Bhutan   23      0    0          0.4
## 21                       Bolivia  167     41    8          3.8
## 22            Bosnia-Herzegovina   76    173    8          4.6
## 23                      Botswana  173     35   35          5.4
## 24                        Brazil  245    145   16          7.2
## 25                        Brunei   31      2    1          0.6
## 26                      Bulgaria  231    252   94         10.3
## 27                  Burkina Faso   25      7    7          4.3
## 28                       Burundi   88      0    0          6.3
## 29                 Cote d Ivoire   37      1    7          4.0
## 30                    Cabo Verde  144     56   16          4.0
## 31                      Cambodia   57     65    1          2.2
## 32                      Cameroon  147      1    4          5.8
## 33                        Canada  240    122  100          8.2
## 34      Central African Republic   17      2    1          1.8
## 35                          Chad   15      1    1          0.4
## 36                         Chile  130    124  172          7.6
## 37                         China   79    192    8          5.0
## 38                      Colombia  159     76    3          4.2
## 39                       Comoros    1      3    1          0.1
## 40                         Congo   76      1    9          1.7
## 41                  Cook Islands    0    254   74          5.9
## 42                    Costa Rica  149     87   11          4.4
## 43                       Croatia  230     87  254         10.2
## 44                          Cuba   93    137    5          4.2
## 45                        Cyprus  192    154  113          8.2
## 46                Czech Republic  361    170  134         11.8
## 47                   North Korea    0      0    0          0.0
## 48                      DR Congo   32      3    1          2.3
## 49                       Denmark  224     81  278         10.4
## 50                      Djibouti   15     44    3          1.1
## 51                      Dominica   52    286   26          6.6
## 52            Dominican Republic  193    147    9          6.2
## 53                       Ecuador  162     74    3          4.2
## 54                         Egypt    6      4    1          0.2
## 55                   El Salvador   52     69    2          2.2
## 56             Equatorial Guinea   92      0  233          5.8
## 57                       Eritrea   18      0    0          0.5
## 58                       Estonia  224    194   59          9.5
## 59                      Ethiopia   20      3    0          0.7
## 60                          Fiji   77     35    1          2.0
## 61                       Finland  263    133   97         10.0
## 62                        France  127    151  370         11.8
## 63                         Gabon  347     98   59          8.9
## 64                        Gambia    8      0    1          2.4
## 65                       Georgia   52    100  149          5.4
## 66                       Germany  346    117  175         11.3
## 67                         Ghana   31      3   10          1.8
## 68                        Greece  133    112  218          8.3
## 69                       Grenada  199    438   28         11.9
## 70                     Guatemala   53     69    2          2.2
## 71                        Guinea    9      0    2          0.2
## 72                 Guinea-Bissau   28     31   21          2.5
## 73                        Guyana   93    302    1          7.1
## 74                         Haiti    1    326    1          5.9
## 75                      Honduras   69     98    2          3.0
## 76                       Hungary  234    215  185         11.3
## 77                       Iceland  233     61   78          6.6
## 78                         India    9    114    0          2.2
## 79                     Indonesia    5      1    0          0.1
## 80                          Iran    0      0    0          0.0
## 81                          Iraq    9      3    0          0.2
## 82                       Ireland  313    118  165         11.4
## 83                        Israel   63     69    9          2.5
## 84                         Italy   85     42  237          6.5
## 85                       Jamaica   82     97    9          3.4
## 86                         Japan   77    202   16          7.0
## 87                        Jordan    6     21    1          0.5
## 88                    Kazakhstan  124    246   12          6.8
## 89                         Kenya   58     22    2          1.8
## 90                      Kiribati   21     34    1          1.0
## 91                        Kuwait    0      0    0          0.0
## 92                    Kyrgyzstan   31     97    6          2.4
## 93                          Laos   62      0  123          6.2
## 94                        Latvia  281    216   62         10.5
## 95                       Lebanon   20     55   31          1.9
## 96                       Lesotho   82     29    0          2.8
## 97                       Liberia   19    152    2          3.1
## 98                         Libya    0      0    0          0.0
## 99                     Lithuania  343    244   56         12.9
## 100                   Luxembourg  236    133  271         11.4
## 101                   Madagascar   26     15    4          0.8
## 102                       Malawi    8     11    1          1.5
## 103                     Malaysia   13      4    0          0.3
## 104                     Maldives    0      0    0          0.0
## 105                         Mali    5      1    1          0.6
## 106                        Malta  149    100  120          6.6
## 107             Marshall Islands    0      0    0          0.0
## 108                   Mauritania    0      0    0          0.0
## 109                    Mauritius   98     31   18          2.6
## 110                       Mexico  238     68    5          5.5
## 111                   Micronesia   62     50   18          2.3
## 112                       Monaco    0      0    0          0.0
## 113                     Mongolia   77    189    8          4.9
## 114                   Montenegro   31    114  128          4.9
## 115                      Morocco   12      6   10          0.5
## 116                   Mozambique   47     18    5          1.3
## 117                      Myanmar    5      1    0          0.1
## 118                      Namibia  376      3    1          6.8
## 119                        Nauru   49      0    8          1.0
## 120                        Nepal    5      6    0          0.2
## 121                  Netherlands  251     88  190          9.4
## 122                  New Zealand  203     79  175          9.3
## 123                    Nicaragua   78    118    1          3.5
## 124                        Niger    3      2    1          0.1
## 125                      Nigeria   42      5    2          9.1
## 126                         Niue  188    200    7          7.0
## 127                       Norway  169     71  129          6.7
## 128                         Oman   22     16    1          0.7
## 129                     Pakistan    0      0    0          0.0
## 130                        Palau  306     63   23          6.9
## 131                       Panama  285    104   18          7.2
## 132             Papua New Guinea   44     39    1          1.5
## 133                     Paraguay  213    117   74          7.3
## 134                         Peru  163    160   21          6.1
## 135                  Philippines   71    186    1          4.6
## 136                       Poland  343    215   56         10.9
## 137                     Portugal  194     67  339         11.0
## 138                        Qatar    1     42    7          0.9
## 139                  South Korea  140     16    9          9.8
## 140                      Moldova  109    226   18          6.3
## 141                      Romania  297    122  167         10.4
## 142           Russian Federation  247    326   73         11.5
## 143                       Rwanda   43      2    0          6.8
## 144            St. Kitts & Nevis  194    205   32          7.7
## 145                    St. Lucia  171    315   71         10.1
## 146 St. Vincent & the Grenadines  120    221   11          6.3
## 147                        Samoa  105     18   24          2.6
## 148                   San Marino    0      0    0          0.0
## 149          Sao Tome & Principe   56     38  140          4.2
## 150                 Saudi Arabia    0      5    0          0.1
## 151                      Senegal    9      1    7          0.3
## 152                       Serbia  283    131  127          9.6
## 153                   Seychelles  157     25   51          4.1
## 154                 Sierra Leone   25      3    2          6.7
## 155                    Singapore   60     12   11          1.5
## 156                     Slovakia  196    293  116         11.4
## 157                     Slovenia  270     51  276         10.6
## 158              Solomon Islands   56     11    1          1.2
## 159                      Somalia    0      0    0          0.0
## 160                 South Africa  225     76   81          8.2
## 161                        Spain  284    157  112         10.0
## 162                    Sri Lanka   16    104    0          2.2
## 163                        Sudan    8     13    0          1.7
## 164                     Suriname  128    178    7          5.6
## 165                    Swaziland   90      2    2          4.7
## 166                       Sweden  152     60  186          7.2
## 167                  Switzerland  185    100  280         10.2
## 168                        Syria    5     35   16          1.0
## 169                   Tajikistan    2     15    0          0.3
## 170                     Thailand   99    258    1          6.4
## 171                    Macedonia  106     27   86          3.9
## 172                  Timor-Leste    1      1    4          0.1
## 173                         Togo   36      2   19          1.3
## 174                        Tonga   36     21    5          1.1
## 175            Trinidad & Tobago  197    156    7          6.4
## 176                      Tunisia   51      3   20          1.3
## 177                       Turkey   51     22    7          1.4
## 178                 Turkmenistan   19     71   32          2.2
## 179                       Tuvalu    6     41    9          1.0
## 180                       Uganda   45      9    0          8.3
## 181                      Ukraine  206    237   45          8.9
## 182         United Arab Emirates   16    135    5          2.8
## 183               United Kingdom  219    126  195         10.4
## 184                     Tanzania   36      6    1          5.7
## 185                          USA  249    158   84          8.7
## 186                      Uruguay  115     35  220          6.6
## 187                   Uzbekistan   25    101    8          2.4
## 188                      Vanuatu   21     18   11          0.9
## 189                    Venezuela  333    100    3          7.7
## 190                      Vietnam  111      2    1          2.0
## 191                        Yemen    6      0    0          0.1
## 192                       Zambia   32     19    4          2.5
## 193                     Zimbabwe   64     18    4          4.7
# Countries without alcohol consumption
NoConsumtion_sub <- subset(AlcoholConsum, BEER == 0.0 & WINE == 0.0)
NoConsumtion_sub <- NoConsumtion_sub[, c("COUNTRY", "BEER", "WINE")]
NoConsumtion_sub
##              COUNTRY BEER WINE
## 1        Afghanistan    0    0
## 14        Bangladesh    0    0
## 47       North Korea    0    0
## 80              Iran    0    0
## 91            Kuwait    0    0
## 98             Libya    0    0
## 104         Maldives    0    0
## 107 Marshall Islands    0    0
## 108       Mauritania    0    0
## 112           Monaco    0    0
## 129         Pakistan    0    0
## 148       San Marino    0    0
## 150     Saudi Arabia    0    0
## 159          Somalia    0    0
# Countries that consume alcohol

AlcoholConsum_sub <- subset(AlcoholConsum, BEER > 0 & WINE > 0 )
AlcoholConsum_sub <- AlcoholConsum_sub[, c("COUNTRY", "BEER", "WINE")]
AlcoholConsum_sub
##                          COUNTRY BEER WINE
## 2                        Albania   89   54
## 3                        Algeria   25   14
## 4                        Andorra  245  312
## 5                         Angola  217   45
## 6              Antigua & Barbuda  102   45
## 7                      Argentina  193  221
## 8                        Armenia   21   11
## 9                      Australia  261  212
## 10                       Austria  279  191
## 11                    Azerbaijan   21    5
## 12                       Bahamas  122   51
## 13                       Bahrain   42    7
## 15                      Barbados  143   36
## 16                       Belarus  142   42
## 17                       Belgium  295  212
## 18                        Belize  263    8
## 19                         Benin   34   13
## 21                       Bolivia  167    8
## 22            Bosnia-Herzegovina   76    8
## 23                      Botswana  173   35
## 24                        Brazil  245   16
## 25                        Brunei   31    1
## 26                      Bulgaria  231   94
## 27                  Burkina Faso   25    7
## 29                 Cote d Ivoire   37    7
## 30                    Cabo Verde  144   16
## 31                      Cambodia   57    1
## 32                      Cameroon  147    4
## 33                        Canada  240  100
## 34      Central African Republic   17    1
## 35                          Chad   15    1
## 36                         Chile  130  172
## 37                         China   79    8
## 38                      Colombia  159    3
## 39                       Comoros    1    1
## 40                         Congo   76    9
## 42                    Costa Rica  149   11
## 43                       Croatia  230  254
## 44                          Cuba   93    5
## 45                        Cyprus  192  113
## 46                Czech Republic  361  134
## 48                      DR Congo   32    1
## 49                       Denmark  224  278
## 50                      Djibouti   15    3
## 51                      Dominica   52   26
## 52            Dominican Republic  193    9
## 53                       Ecuador  162    3
## 54                         Egypt    6    1
## 55                   El Salvador   52    2
## 56             Equatorial Guinea   92  233
## 58                       Estonia  224   59
## 60                          Fiji   77    1
## 61                       Finland  263   97
## 62                        France  127  370
## 63                         Gabon  347   59
## 64                        Gambia    8    1
## 65                       Georgia   52  149
## 66                       Germany  346  175
## 67                         Ghana   31   10
## 68                        Greece  133  218
## 69                       Grenada  199   28
## 70                     Guatemala   53    2
## 71                        Guinea    9    2
## 72                 Guinea-Bissau   28   21
## 73                        Guyana   93    1
## 74                         Haiti    1    1
## 75                      Honduras   69    2
## 76                       Hungary  234  185
## 77                       Iceland  233   78
## 82                       Ireland  313  165
## 83                        Israel   63    9
## 84                         Italy   85  237
## 85                       Jamaica   82    9
## 86                         Japan   77   16
## 87                        Jordan    6    1
## 88                    Kazakhstan  124   12
## 89                         Kenya   58    2
## 90                      Kiribati   21    1
## 92                    Kyrgyzstan   31    6
## 93                          Laos   62  123
## 94                        Latvia  281   62
## 95                       Lebanon   20   31
## 97                       Liberia   19    2
## 99                     Lithuania  343   56
## 100                   Luxembourg  236  271
## 101                   Madagascar   26    4
## 102                       Malawi    8    1
## 105                         Mali    5    1
## 106                        Malta  149  120
## 109                    Mauritius   98   18
## 110                       Mexico  238    5
## 111                   Micronesia   62   18
## 113                     Mongolia   77    8
## 114                   Montenegro   31  128
## 115                      Morocco   12   10
## 116                   Mozambique   47    5
## 118                      Namibia  376    1
## 119                        Nauru   49    8
## 121                  Netherlands  251  190
## 122                  New Zealand  203  175
## 123                    Nicaragua   78    1
## 124                        Niger    3    1
## 125                      Nigeria   42    2
## 126                         Niue  188    7
## 127                       Norway  169  129
## 128                         Oman   22    1
## 130                        Palau  306   23
## 131                       Panama  285   18
## 132             Papua New Guinea   44    1
## 133                     Paraguay  213   74
## 134                         Peru  163   21
## 135                  Philippines   71    1
## 136                       Poland  343   56
## 137                     Portugal  194  339
## 138                        Qatar    1    7
## 139                  South Korea  140    9
## 140                      Moldova  109   18
## 141                      Romania  297  167
## 142           Russian Federation  247   73
## 144            St. Kitts & Nevis  194   32
## 145                    St. Lucia  171   71
## 146 St. Vincent & the Grenadines  120   11
## 147                        Samoa  105   24
## 149          Sao Tome & Principe   56  140
## 151                      Senegal    9    7
## 152                       Serbia  283  127
## 153                   Seychelles  157   51
## 154                 Sierra Leone   25    2
## 155                    Singapore   60   11
## 156                     Slovakia  196  116
## 157                     Slovenia  270  276
## 158              Solomon Islands   56    1
## 160                 South Africa  225   81
## 161                        Spain  284  112
## 164                     Suriname  128    7
## 165                    Swaziland   90    2
## 166                       Sweden  152  186
## 167                  Switzerland  185  280
## 168                        Syria    5   16
## 170                     Thailand   99    1
## 171                    Macedonia  106   86
## 172                  Timor-Leste    1    4
## 173                         Togo   36   19
## 174                        Tonga   36    5
## 175            Trinidad & Tobago  197    7
## 176                      Tunisia   51   20
## 177                       Turkey   51    7
## 178                 Turkmenistan   19   32
## 179                       Tuvalu    6    9
## 181                      Ukraine  206   45
## 182         United Arab Emirates   16    5
## 183               United Kingdom  219  195
## 184                     Tanzania   36    1
## 185                          USA  249   84
## 186                      Uruguay  115  220
## 187                   Uzbekistan   25    8
## 188                      Vanuatu   21   11
## 189                    Venezuela  333    3
## 190                      Vietnam  111    1
## 192                       Zambia   32    4
## 193                     Zimbabwe   64    4
# Top 10 countries with highest consumption of alcohol pe liter

TopConsum <- head(arrange(AlcoholConsum, desc(AlcoholConsum$`TOTAL LITRES`)), n = 10)
TopConsum <- TopConsum[, c("COUNTRY", "BEER", "WINE")]
TopConsum
##               COUNTRY BEER WINE
## 1             Belarus  142   42
## 2           Lithuania  343   56
## 3             Andorra  245  312
## 4             Grenada  199   28
## 5      Czech Republic  361  134
## 6              France  127  370
## 7  Russian Federation  247   73
## 8             Ireland  313  165
## 9          Luxembourg  236  271
## 10           Slovakia  196  116
Consumgg <- ggplot(NULL, aes(x, y)) + 
geom_line(data=TopConsum, aes(x=COUNTRY, y=WINE, group=1), col="green") +
geom_line(data=TopConsum, aes(x=COUNTRY, y=BEER, group=1), col="purple")+
  labs(title = "WINE & BEER CONSUMPTION BY COUNTRY", x= "COUNTRY", y = "TOTAL SERVINGS", ylim=c(100,1000), breaks = 10) + 
  theme(axis.text.x = element_text(angle = 60, hjust = 1))

# display the plot
Consumgg

CONCLUSION

The study shows that based on the top 10 total consumption by litre, beer was more popular than wine. Out Of the 194 countries 14 did not consume any alcohol.