2. Input Data
happy_21 <- read.csv("data/world-happiness-report-2021.csv")
Input data is DONE !
2.1 Data Inspection
head(happy_21)
## ï..Country.name Regional.indicator Ladder.score
## 1 Finland Western Europe 7.842
## 2 Denmark Western Europe 7.620
## 3 Switzerland Western Europe 7.571
## 4 Iceland Western Europe 7.554
## 5 Netherlands Western Europe 7.464
## 6 Norway Western Europe 7.392
## Standard.error.of.ladder.score upperwhisker lowerwhisker
## 1 0.032 7.904 7.780
## 2 0.035 7.687 7.552
## 3 0.036 7.643 7.500
## 4 0.059 7.670 7.438
## 5 0.027 7.518 7.410
## 6 0.035 7.462 7.323
## Logged.GDP.per.capita Social.support Healthy.life.expectancy
## 1 10.775 0.954 72.0
## 2 10.933 0.954 72.7
## 3 11.117 0.942 74.4
## 4 10.878 0.983 73.0
## 5 10.932 0.942 72.4
## 6 11.053 0.954 73.3
## Freedom.to.make.life.choices Generosity Perceptions.of.corruption
## 1 0.949 -0.098 0.186
## 2 0.946 0.030 0.179
## 3 0.919 0.025 0.292
## 4 0.955 0.160 0.673
## 5 0.913 0.175 0.338
## 6 0.960 0.093 0.270
## Ladder.score.in.Dystopia Explained.by..Log.GDP.per.capita
## 1 2.43 1.446
## 2 2.43 1.502
## 3 2.43 1.566
## 4 2.43 1.482
## 5 2.43 1.501
## 6 2.43 1.543
## Explained.by..Social.support Explained.by..Healthy.life.expectancy
## 1 1.106 0.741
## 2 1.108 0.763
## 3 1.079 0.816
## 4 1.172 0.772
## 5 1.079 0.753
## 6 1.108 0.782
## Explained.by..Freedom.to.make.life.choices Explained.by..Generosity
## 1 0.691 0.124
## 2 0.686 0.208
## 3 0.653 0.204
## 4 0.698 0.293
## 5 0.647 0.302
## 6 0.703 0.249
## Explained.by..Perceptions.of.corruption Dystopia...residual
## 1 0.481 3.253
## 2 0.485 2.868
## 3 0.413 2.839
## 4 0.170 2.967
## 5 0.384 2.798
## 6 0.427 2.580
tail(happy_21)
## ï..Country.name Regional.indicator Ladder.score
## 144 Malawi Sub-Saharan Africa 3.600
## 145 Lesotho Sub-Saharan Africa 3.512
## 146 Botswana Sub-Saharan Africa 3.467
## 147 Rwanda Sub-Saharan Africa 3.415
## 148 Zimbabwe Sub-Saharan Africa 3.145
## 149 Afghanistan South Asia 2.523
## Standard.error.of.ladder.score upperwhisker lowerwhisker
## 144 0.092 3.781 3.419
## 145 0.120 3.748 3.276
## 146 0.074 3.611 3.322
## 147 0.068 3.548 3.282
## 148 0.058 3.259 3.030
## 149 0.038 2.596 2.449
## Logged.GDP.per.capita Social.support Healthy.life.expectancy
## 144 6.958 0.537 57.948
## 145 7.926 0.787 48.700
## 146 9.782 0.784 59.269
## 147 7.676 0.552 61.400
## 148 7.943 0.750 56.201
## 149 7.695 0.463 52.493
## Freedom.to.make.life.choices Generosity Perceptions.of.corruption
## 144 0.780 0.038 0.729
## 145 0.715 -0.131 0.915
## 146 0.824 -0.246 0.801
## 147 0.897 0.061 0.167
## 148 0.677 -0.047 0.821
## 149 0.382 -0.102 0.924
## Ladder.score.in.Dystopia Explained.by..Log.GDP.per.capita
## 144 2.43 0.113
## 145 2.43 0.451
## 146 2.43 1.099
## 147 2.43 0.364
## 148 2.43 0.457
## 149 2.43 0.370
## Explained.by..Social.support Explained.by..Healthy.life.expectancy
## 144 0.168 0.298
## 145 0.731 0.007
## 146 0.724 0.340
## 147 0.202 0.407
## 148 0.649 0.243
## 149 0.000 0.126
## Explained.by..Freedom.to.make.life.choices Explained.by..Generosity
## 144 0.484 0.213
## 145 0.405 0.103
## 146 0.539 0.027
## 147 0.627 0.227
## 148 0.359 0.157
## 149 0.000 0.122
## Explained.by..Perceptions.of.corruption Dystopia...residual
## 144 0.134 2.190
## 145 0.015 1.800
## 146 0.088 0.648
## 147 0.493 1.095
## 148 0.075 1.205
## 149 0.010 1.895
dim(happy_21)
## [1] 149 20
names(happy_21)
## [1] "ï..Country.name"
## [2] "Regional.indicator"
## [3] "Ladder.score"
## [4] "Standard.error.of.ladder.score"
## [5] "upperwhisker"
## [6] "lowerwhisker"
## [7] "Logged.GDP.per.capita"
## [8] "Social.support"
## [9] "Healthy.life.expectancy"
## [10] "Freedom.to.make.life.choices"
## [11] "Generosity"
## [12] "Perceptions.of.corruption"
## [13] "Ladder.score.in.Dystopia"
## [14] "Explained.by..Log.GDP.per.capita"
## [15] "Explained.by..Social.support"
## [16] "Explained.by..Healthy.life.expectancy"
## [17] "Explained.by..Freedom.to.make.life.choices"
## [18] "Explained.by..Generosity"
## [19] "Explained.by..Perceptions.of.corruption"
## [20] "Dystopia...residual"
From our inspection we can conclude :
* happy_21 dataset contain 149 of rows (that mean in dataset include 149 countries) and 20 of coloumns (variabels)
* Each of column name : “ï..Country.name”,“Regional.indicator”,“Ladder.score”,“Standard.error.of.ladder.score”,“upperwhisker”,“lowerwhisker”,“Logged.GDP.per.capita”,“Social.support”,“Healthy.life.expectancy”,“Freedom.to.make.life.choices”,“Generosity”,“Perceptions.of.corruption”,“Ladder.score.in.Dystopia”,“Explained.by..Log.GDP.per.capita”,“Explained.by..Social.support”,“Explained.by..Healthy.life.expectancy”,“Explained.by..Freedom.to.make.life.choices”,“Explained.by..Generosity”,“Explained.by..Perceptions.of.corruption”,“Dystopia…residual”
In this case, I will only take a few variables for analysis.
2.2 Data Cleansing & Coertions
str(happy_21)
## 'data.frame': 149 obs. of 20 variables:
## $ ï..Country.name : chr "Finland" "Denmark" "Switzerland" "Iceland" ...
## $ Regional.indicator : chr "Western Europe" "Western Europe" "Western Europe" "Western Europe" ...
## $ Ladder.score : num 7.84 7.62 7.57 7.55 7.46 ...
## $ Standard.error.of.ladder.score : num 0.032 0.035 0.036 0.059 0.027 0.035 0.036 0.037 0.04 0.036 ...
## $ upperwhisker : num 7.9 7.69 7.64 7.67 7.52 ...
## $ lowerwhisker : num 7.78 7.55 7.5 7.44 7.41 ...
## $ Logged.GDP.per.capita : num 10.8 10.9 11.1 10.9 10.9 ...
## $ Social.support : num 0.954 0.954 0.942 0.983 0.942 0.954 0.934 0.908 0.948 0.934 ...
## $ Healthy.life.expectancy : num 72 72.7 74.4 73 72.4 73.3 72.7 72.6 73.4 73.3 ...
## $ Freedom.to.make.life.choices : num 0.949 0.946 0.919 0.955 0.913 0.96 0.945 0.907 0.929 0.908 ...
## $ Generosity : num -0.098 0.03 0.025 0.16 0.175 0.093 0.086 -0.034 0.134 0.042 ...
## $ Perceptions.of.corruption : num 0.186 0.179 0.292 0.673 0.338 0.27 0.237 0.386 0.242 0.481 ...
## $ Ladder.score.in.Dystopia : num 2.43 2.43 2.43 2.43 2.43 2.43 2.43 2.43 2.43 2.43 ...
## $ Explained.by..Log.GDP.per.capita : num 1.45 1.5 1.57 1.48 1.5 ...
## $ Explained.by..Social.support : num 1.11 1.11 1.08 1.17 1.08 ...
## $ Explained.by..Healthy.life.expectancy : num 0.741 0.763 0.816 0.772 0.753 0.782 0.763 0.76 0.785 0.782 ...
## $ Explained.by..Freedom.to.make.life.choices: num 0.691 0.686 0.653 0.698 0.647 0.703 0.685 0.639 0.665 0.64 ...
## $ Explained.by..Generosity : num 0.124 0.208 0.204 0.293 0.302 0.249 0.244 0.166 0.276 0.215 ...
## $ Explained.by..Perceptions.of.corruption : num 0.481 0.485 0.413 0.17 0.384 0.427 0.448 0.353 0.445 0.292 ...
## $ Dystopia...residual : num 3.25 2.87 2.84 2.97 2.8 ...
In this case, there is a variable that has an inappropriate data type, namely “Regional.indicator”, which should be a category/factor, then the variable “Regional.indicator” will be changed to a factor data type.
happy_21$Regional.indicator <- as.factor(happy_21$Regional.indicator)
str(happy_21)
## 'data.frame': 149 obs. of 20 variables:
## $ ï..Country.name : chr "Finland" "Denmark" "Switzerland" "Iceland" ...
## $ Regional.indicator : Factor w/ 10 levels "Central and Eastern Europe",..: 10 10 10 10 10 10 10 10 6 10 ...
## $ Ladder.score : num 7.84 7.62 7.57 7.55 7.46 ...
## $ Standard.error.of.ladder.score : num 0.032 0.035 0.036 0.059 0.027 0.035 0.036 0.037 0.04 0.036 ...
## $ upperwhisker : num 7.9 7.69 7.64 7.67 7.52 ...
## $ lowerwhisker : num 7.78 7.55 7.5 7.44 7.41 ...
## $ Logged.GDP.per.capita : num 10.8 10.9 11.1 10.9 10.9 ...
## $ Social.support : num 0.954 0.954 0.942 0.983 0.942 0.954 0.934 0.908 0.948 0.934 ...
## $ Healthy.life.expectancy : num 72 72.7 74.4 73 72.4 73.3 72.7 72.6 73.4 73.3 ...
## $ Freedom.to.make.life.choices : num 0.949 0.946 0.919 0.955 0.913 0.96 0.945 0.907 0.929 0.908 ...
## $ Generosity : num -0.098 0.03 0.025 0.16 0.175 0.093 0.086 -0.034 0.134 0.042 ...
## $ Perceptions.of.corruption : num 0.186 0.179 0.292 0.673 0.338 0.27 0.237 0.386 0.242 0.481 ...
## $ Ladder.score.in.Dystopia : num 2.43 2.43 2.43 2.43 2.43 2.43 2.43 2.43 2.43 2.43 ...
## $ Explained.by..Log.GDP.per.capita : num 1.45 1.5 1.57 1.48 1.5 ...
## $ Explained.by..Social.support : num 1.11 1.11 1.08 1.17 1.08 ...
## $ Explained.by..Healthy.life.expectancy : num 0.741 0.763 0.816 0.772 0.753 0.782 0.763 0.76 0.785 0.782 ...
## $ Explained.by..Freedom.to.make.life.choices: num 0.691 0.686 0.653 0.698 0.647 0.703 0.685 0.639 0.665 0.64 ...
## $ Explained.by..Generosity : num 0.124 0.208 0.204 0.293 0.302 0.249 0.244 0.166 0.276 0.215 ...
## $ Explained.by..Perceptions.of.corruption : num 0.481 0.485 0.413 0.17 0.384 0.427 0.448 0.353 0.445 0.292 ...
## $ Dystopia...residual : num 3.25 2.87 2.84 2.97 2.8 ...
Great! Now, each of column already changed into desired data type
Next, check for missing values:
colSums(is.na(happy_21))
## ï..Country.name
## 0
## Regional.indicator
## 0
## Ladder.score
## 0
## Standard.error.of.ladder.score
## 0
## upperwhisker
## 0
## lowerwhisker
## 0
## Logged.GDP.per.capita
## 0
## Social.support
## 0
## Healthy.life.expectancy
## 0
## Freedom.to.make.life.choices
## 0
## Generosity
## 0
## Perceptions.of.corruption
## 0
## Ladder.score.in.Dystopia
## 0
## Explained.by..Log.GDP.per.capita
## 0
## Explained.by..Social.support
## 0
## Explained.by..Healthy.life.expectancy
## 0
## Explained.by..Freedom.to.make.life.choices
## 0
## Explained.by..Generosity
## 0
## Explained.by..Perceptions.of.corruption
## 0
## Dystopia...residual
## 0
anyNA(happy_21)
## [1] FALSE
Excelent! No Missing value in happy_21 dataset.
Several variables will be selected to be used in the analysis.
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.0.5
##
## 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
happy_21_clear <- happy_21 %>%
select("Country" = ï..Country.name,"Region" = Regional.indicator,"Happiness Score" = Ladder.score,
"Economy" = Logged.GDP.per.capita,"Health" = Healthy.life.expectancy,
"Freedom" = Freedom.to.make.life.choices, Perceptions.of.corruption, Generosity,
"Dystopia Residual" = Dystopia...residual) %>%
mutate("Trust" = 1-Perceptions.of.corruption) %>%
select(-Perceptions.of.corruption)
head(happy_21_clear)
## Country Region Happiness Score Economy Health Freedom Generosity
## 1 Finland Western Europe 7.842 10.775 72.0 0.949 -0.098
## 2 Denmark Western Europe 7.620 10.933 72.7 0.946 0.030
## 3 Switzerland Western Europe 7.571 11.117 74.4 0.919 0.025
## 4 Iceland Western Europe 7.554 10.878 73.0 0.955 0.160
## 5 Netherlands Western Europe 7.464 10.932 72.4 0.913 0.175
## 6 Norway Western Europe 7.392 11.053 73.3 0.960 0.093
## Dystopia Residual Trust
## 1 3.253 0.814
## 2 2.868 0.821
## 3 2.839 0.708
## 4 2.967 0.327
## 5 2.798 0.662
## 6 2.580 0.730
Note:
Economy: GDP per Capita
Health: Life Expectancy
Trust: Absence of Corruption
Now, happy_21_clear dataset is ready to be processed and analyzed.
3. Data Explanation
3.1 Summary Statistics
Summary Statistics happy_21_clear dataset
summary(happy_21_clear)
## Country Region Happiness Score
## Length:149 Sub-Saharan Africa :36 Min. :2.523
## Class :character Western Europe :21 1st Qu.:4.852
## Mode :character Latin America and Caribbean :20 Median :5.534
## Central and Eastern Europe :17 Mean :5.533
## Middle East and North Africa :17 3rd Qu.:6.255
## Commonwealth of Independent States:12 Max. :7.842
## (Other) :26
## Economy Health Freedom Generosity
## Min. : 6.635 Min. :48.48 Min. :0.3820 Min. :-0.28800
## 1st Qu.: 8.541 1st Qu.:59.80 1st Qu.:0.7180 1st Qu.:-0.12600
## Median : 9.569 Median :66.60 Median :0.8040 Median :-0.03600
## Mean : 9.432 Mean :64.99 Mean :0.7916 Mean :-0.01513
## 3rd Qu.:10.421 3rd Qu.:69.60 3rd Qu.:0.8770 3rd Qu.: 0.07900
## Max. :11.647 Max. :76.95 Max. :0.9700 Max. : 0.54200
##
## Dystopia Residual Trust
## Min. :0.648 Min. :0.0610
## 1st Qu.:2.138 1st Qu.:0.1550
## Median :2.509 Median :0.2190
## Mean :2.430 Mean :0.2726
## 3rd Qu.:2.794 3rd Qu.:0.3330
## Max. :3.482 Max. :0.9180
##
Summary:
1. happy_21_clear dataset contain 149 countries.
2. Based on the Region there are:
- 36 countries from Sub-Saharan Africa,
- 21 countries are from Western Europe,
- 20 countries originating from Latin America and the Caribbean,
- 17 countries from Central and Eastern Europe,
- 17 countries from Middle East and North Africa,
- 12 countries are from the Commonwealth of Independent States,
- And the remaining 26 are from other regions.
3. Based on the Happiness Score, countries in the world have:
- Average value: 5.533,
- Minimum value: 2.523,
- Maximum value: 7.842.
4. Based on the Economy, countries in the world have:
- Average value: 9.432,
- Minimum value: 6.635,
- Maximum value: 11.647.
5. Based on the Health, countries in the world have:
- Average value: 64.99,
- Minimum value: 48.48,
- Maximum value: 76.95.
6. Based on the Freedom, countries in the world have:
- Average value: 0.7916,
- Minimum value: 0.3820,
- Maximum value: 0.9700.
7. Based on the Generosity, countries in the world have:
- Average value: -0.015,
- Minimum value: -0.288,
- Maximum value: 0.542.
8. Based on the Dystopia Residual, countries in the world have:
- Average value: 2.430,
- Minimum value: 0.648,
- Maximum value: 3.482.
9. Based on the Freedom, countries in the world have:
- Average value: 0.2726,
- Minimum value: 0.0610,
- Maximum value: 0.9180.
3.2 Check Outlier
par(mfrow=c(2,1))
boxplot(happy_21_clear$`Happiness Score`, main = "Happiness Score", horizontal = T)
boxplot(happy_21_clear$Economy, main = "Economy (GDP per Capita)", horizontal = T)

par(mfrow=c(2,1))
boxplot(happy_21_clear$Health, main = "Health (Life Expectancy)", horizontal = T)
boxplot(happy_21_clear$Freedom, main = "Freedom", horizontal = T)

par(mfrow=c(2,1))
boxplot(happy_21_clear$Generosity, main = "Generosity", horizontal = T)
boxplot(happy_21_clear$`Dystopia Residual`, main = "Dystopia Residual", horizontal = T)

boxplot(happy_21_clear$Trust, main = "Trust (Absence of Corruption)", horizontal = T)
Insight:
From the above results it can be seen that,
Variables with many outliers: “Trust”, “Generosity”
Variables with few outliers: “Dystopia Residual”,“Freedom”,“Happiness Score”
Variables without outliers: “Health”,“Economy”
Note:
In more advanced cases outliers will become a significant problem and must be solved. Ways to deal with outliers such as Transformation, removing outliers and other ways.
4. Explanatory & Business Question
Q1: The happiest country in the world is…
happy_21_clear %>%
arrange(desc(`Happiness Score`)) %>%
mutate("Happiness Rank" = as.integer(rank(-`Happiness Score`))) %>%
slice_max(`Happiness Score`, n = 10) %>%
select(Country, Region, `Happiness Score`,`Happiness Rank`)
## Country Region Happiness Score Happiness Rank
## 1 Finland Western Europe 7.842 1
## 2 Denmark Western Europe 7.620 2
## 3 Switzerland Western Europe 7.571 3
## 4 Iceland Western Europe 7.554 4
## 5 Netherlands Western Europe 7.464 5
## 6 Norway Western Europe 7.392 6
## 7 Sweden Western Europe 7.363 7
## 8 Luxembourg Western Europe 7.324 8
## 9 New Zealand North America and ANZ 7.277 9
## 10 Austria Western Europe 7.268 10
Insight:
1. Finland is the happiest country in the world in 2021.
2. Most of the happiest countries in the world in 2021 will be from the Western Europe Region.
Q2: The saddest country in the world is…
happy_21_clear %>%
arrange(desc(`Happiness Score`)) %>%
mutate("Happiness Rank" = as.integer(rank(-`Happiness Score`))) %>%
slice_min(`Happiness Score`, n = 10) %>%
select(Country, Region, `Happiness Score`,`Happiness Rank`) %>%
arrange(`Happiness Rank`)
## Country Region Happiness Score Happiness Rank
## 1 Burundi Sub-Saharan Africa 3.775 140
## 2 Yemen Middle East and North Africa 3.658 141
## 3 Tanzania Sub-Saharan Africa 3.623 142
## 4 Haiti Latin America and Caribbean 3.615 143
## 5 Malawi Sub-Saharan Africa 3.600 144
## 6 Lesotho Sub-Saharan Africa 3.512 145
## 7 Botswana Sub-Saharan Africa 3.467 146
## 8 Rwanda Sub-Saharan Africa 3.415 147
## 9 Zimbabwe Sub-Saharan Africa 3.145 148
## 10 Afghanistan South Asia 2.523 149
Insight:
1. Afghanistan from South Asia is the saddest country in the world in 2021
2. Most of the saddest countries in the world in 2021 will be from the Sub-Saharan Africa Region.
Q3: What is Indonesia’s rank? and what is the value of Indonesia’s Happiness Score?
happy_21_clear %>%
arrange(desc(`Happiness Score`)) %>%
mutate("Happiness Rank" = as.integer(rank(-`Happiness Score`))) %>%
select(Country, Region, `Happiness Score`,`Happiness Rank`) %>%
filter(Country == "Indonesia")
## Country Region Happiness Score Happiness Rank
## 1 Indonesia Southeast Asia 5.345 82
Insight:
1. Indonesia is ranked 82 for the happiest country.
2. Indonesia has a score of 5.345.
Q4: The country with the highest GDP per Capita is…
happy_21_clear %>%
arrange(desc(Economy)) %>%
slice_max(Economy, n = 10) %>%
select(Country, Region, Economy)
## Country Region Economy
## 1 Luxembourg Western Europe 11.647
## 2 Singapore Southeast Asia 11.488
## 3 Ireland Western Europe 11.342
## 4 Switzerland Western Europe 11.117
## 5 United Arab Emirates Middle East and North Africa 11.085
## 6 Norway Western Europe 11.053
## 7 United States North America and ANZ 11.023
## 8 Hong Kong S.A.R. of China East Asia 11.000
## 9 Denmark Western Europe 10.933
## 10 Netherlands Western Europe 10.932
Insight:
1. Luxembourg is the country with the highest GDP per Capita in 2021.
2. Most of the country with the highest GDP per Capita in 2021 will be from the Western Europe Region.
Q5: The country with the smallest GDP per Capita is…
happy_21_clear %>%
slice_min(Economy, n = 10) %>%
select(Country, Region, Economy) %>%
arrange(desc(Economy))
## Country Region Economy
## 1 Haiti Latin America and Caribbean 7.477
## 2 Sierra Leone Sub-Saharan Africa 7.434
## 3 Madagascar Sub-Saharan Africa 7.396
## 4 Chad Sub-Saharan Africa 7.364
## 5 Togo Sub-Saharan Africa 7.362
## 6 Liberia Sub-Saharan Africa 7.288
## 7 Mozambique Sub-Saharan Africa 7.158
## 8 Niger Sub-Saharan Africa 7.098
## 9 Malawi Sub-Saharan Africa 6.958
## 10 Burundi Sub-Saharan Africa 6.635
Insight:
1. Burundi is the country with the smallest GDP per Capita in the world in 2021
2. Most of the country with the smallest GDP per Capita in the world in 2021 will be from the Sub-Saharan Africa Region.
Q6: What is the value of Indonesia’s GDP per Capita?
happy_21_clear %>%
arrange(desc(Economy)) %>%
select(Country, Region, Economy) %>%
filter(Country == "Indonesia")
## Country Region Economy
## 1 Indonesia Southeast Asia 9.365
Insight:
1. Indonesia has a GDP per Capita of 9.365
Q7: Which countries is the healthiest(long Life Expectancy)?
happy_21_clear %>%
slice_max(Health, n = 10) %>%
select(Country, Region, Health)
## Country Region Health
## 1 Singapore Southeast Asia 76.953
## 2 Hong Kong S.A.R. of China East Asia 76.820
## 3 Japan East Asia 75.100
## 4 Spain Western Europe 74.700
## 5 Switzerland Western Europe 74.400
## 6 France Western Europe 74.000
## 7 Australia North America and ANZ 73.900
## 8 South Korea East Asia 73.900
## 9 Cyprus Western Europe 73.898
## 10 North Cyprus Western Europe 73.898
Insight:
1. Singapore is the healthiest country in the world in 2021, where can reach 76~77 years.
2. Most of the healthiest countries in the world in 2021 will be from the Western Europe Region.
Q8: What is the life expectancy of people in Indonesia?
happy_21_clear %>%
select(Country, Region, Health) %>%
filter(Country == "Indonesia")
## Country Region Health
## 1 Indonesia Southeast Asia 62.236
Insight:
1. People in Indonesia can reach ~62 years.
Q9: Which country is the most freedom(Freedom to make life choices)?
happy_21_clear %>%
slice_max(Freedom, n = 10) %>%
select(Country, Region, Freedom)
## Country Region Freedom
## 1 Uzbekistan Commonwealth of Independent States 0.970
## 2 Norway Western Europe 0.960
## 3 Cambodia Southeast Asia 0.959
## 4 Iceland Western Europe 0.955
## 5 Finland Western Europe 0.949
## 6 Slovenia Central and Eastern Europe 0.949
## 7 Denmark Western Europe 0.946
## 8 Sweden Western Europe 0.945
## 9 Vietnam Southeast Asia 0.940
## 10 Kyrgyzstan Commonwealth of Independent States 0.935
Insight:
1. Uzbekistan gives its citizens 97% freedom to choose their own way of life.
2. Most of the country with the most freedom in 2021 will be from the Western Europe Region.
Q10: Which country gives the least freedom to its citizens?
happy_21_clear %>%
slice_min(Freedom, n = 10) %>%
select(Country, Region, Freedom) %>%
arrange(desc(Freedom))
## Country Region Freedom
## 1 Haiti Latin America and Caribbean 0.593
## 2 Greece Western Europe 0.582
## 3 Chad Sub-Saharan Africa 0.579
## 4 Turkey Middle East and North Africa 0.576
## 5 Mauritania Sub-Saharan Africa 0.561
## 6 Madagascar Sub-Saharan Africa 0.552
## 7 Comoros Sub-Saharan Africa 0.548
## 8 Lebanon Middle East and North Africa 0.525
## 9 Algeria Middle East and North Africa 0.480
## 10 Afghanistan South Asia 0.382
Insight:
1. Afghanistan gives its citizens 38.2% freedom to choose their own way of life.
2. Most of the country with the least freedom in 2021 will be from the Africa Region.
Q11: Which country is the most free from corruption?
happy_21_clear %>%
slice_max(Trust, n = 10) %>%
select(Country, Region, Trust)
## Country Region Trust
## 1 Singapore Southeast Asia 0.918
## 2 Rwanda Sub-Saharan Africa 0.833
## 3 Denmark Western Europe 0.821
## 4 Finland Western Europe 0.814
## 5 Sweden Western Europe 0.763
## 6 New Zealand North America and ANZ 0.758
## 7 Norway Western Europe 0.730
## 8 Switzerland Western Europe 0.708
## 9 Netherlands Western Europe 0.662
## 10 Ireland Western Europe 0.637
Insight:
1. By 91.8% Singapore free from corruption.
2. Most of the country with the the most free from corruption in 2021 will be from the Western Europe Region.
Q12: Is Indonesia free from corruption?
happy_21_clear %>%
select(Country, Region, Trust) %>%
filter(Country == "Indonesia")
## Country Region Trust
## 1 Indonesia Southeast Asia 0.133
Insight:
1. By 13.3% Indonesia free from corruption. This means that the number of corruption in Indonesia is still quite high.