library(readxl)path <-"assignment02_happyPlanetData.xlsx"hpi <-read_xlsx(path, sheet ="1. All countries", range="A9:L161")
New names:
• `` -> `...4`
summary(hpi)
HPI rank Country ISO ...4
Min. : 1.00 Length:152 Length:152 Length:152
1st Qu.: 38.75 Class :character Class :character Class :character
Median : 76.50 Mode :character Mode :character Mode :character
Mean : 76.50
3rd Qu.:114.25
Max. :152.00
Continent Population (thousands) Life Expectancy (years)
Min. :1.000 Min. : 299.9 Min. :53.30
1st Qu.:3.000 1st Qu.: 4970.4 1st Qu.:67.25
Median :5.000 Median : 11521.8 Median :74.65
Mean :4.717 Mean : 49738.8 Mean :73.06
3rd Qu.:7.000 3rd Qu.: 37530.2 3rd Qu.:78.62
Max. :8.000 Max. :1433783.7 Max. :84.90
Ladder of life (Wellbeing) (0-10) Ecological Footprint (g ha) HPI
Min. :2.375 Min. : 0.5157 Min. :24.33
1st Qu.:4.819 1st Qu.: 1.5019 1st Qu.:39.32
Median :5.526 Median : 2.5710 Median :44.70
Mean :5.532 Mean : 3.3252 Mean :44.55
3rd Qu.:6.282 3rd Qu.: 4.4461 3rd Qu.:50.87
Max. :7.780 Max. :15.0376 Max. :62.06
Biocapacity for year \r\n(g ha) GDP per capita ($)
Min. :1.56 Length:152
1st Qu.:1.56 Class :character
Median :1.56 Mode :character
Mean :1.56
3rd Qu.:1.56
Max. :1.56
hpi <-subset(hpi, select=-...4) # drop ...4 columnnames(hpi) =c('rank', 'country', 'iso', 'continent', 'population', 'life_exp', 'wellbeing', 'footprint', 'hpi', 'biocapacity', 'gdp') # rename columnsclass(hpi$gdp) ="double"# set gdp from character to double
Warning in class(hpi$gdp) = "double": NAs introduced by coercion
Our team members worked collaboratively to produce these plots. The bar chart with varying widths was spearheaded by Vikrant and Namrta, and the facetted charts were primarily done by Eli and Seongdeok. Additionally, fonts were added by Vikrant; titles, captions, themes, colors, and axis labels were added by Lizzie; Eli merged these additions with the main plot code; and Namrta had the idea to use simple custom data to aid in plot creation.