knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
The wellber package is a wrapper for the OECD's 2017 Better Life data and enables country well-being comparison across 24 Better Life indicators for 38 OECD countries.
The package provides simple loading, selection, and plotting of the OECD's 2017 Better Life data, based on country, indicator, sample type, and a window size.
For ease-of-use the package includes a shiny app to allow more interactive exploration of a country's well-being performance. For those interested in exploring the app, call wellber::launch.wellber()
to launch the Well-Being Comparison Tool. A screenshot of the tool is provided below.
knitr::include_graphics("/Users/jvard/Documents/MSc Data Analytics/Year_3/Adv Data Prog with R (STAT40830)/Wk_11/wellber/vignettes/wellber_app_screen.png")
load.wellber()
load.wellber()
loads the OECD dataset (stored internally within the package), removes unwanted information and creates the Class column variable to group well-being indicators across 11 well-being categories.
library(wellber) data_object = load.wellber() head(data_object)
The OECD's 2017 Better Life dataset comprises of data from 38 countries, covering 24 well-being indicators. The raw dataset is composed of 8 variables and 3,388 individual data-points.
selector()
selector()
accepts a object of type wellber, as provided by load.wellber()
and the function filters the data.
For the below example a country is selected along with an well-being indicator. In this case, we're interested in exploring Chile's relative performance in relation to Housing Expenditure. The samp_type
and wind_size
parameters determine the sample type (Men, Women, Total) and plot window size (Large, Medium, Small).
data_object = load.wellber() subset_data = selector(data_object, country = 'Chile', qual_ind = 'Housing expenditure', samp_type = 'Total', wind_size = 'Small') subset_data
For guidance on the country
and qual_ind
options refer to the Country and well-being list section at the bottom of this vingnette.
wellber::selector()
also returns a list object of type wellber that includes:
plot()
The filtered data from selector()
may be plotted using plot()
.
data_object = load.wellber() subset_data = selector(data_object, country = 'Chile', qual_ind = 'Housing expenditure', samp_type = 'Total', wind_size = 'Small') plot(subset_data, ind_class = 0) plot(subset_data, ind_class = 1)
knitr::include_graphics("/Users/jvard/Documents/MSc Data Analytics/Year_3/Adv Data Prog with R (STAT40830)/Wk_11/wellber/vignettes/wellber_plots.png")
The plots display the Housing expenditure for Chile (left) and housing performance generally (right) that is a combination of other housing related indicators.
The wind_size argument from selector()
controls the plot window - in this case, only 5 bars are displayed. For each plot relative rankings are displayed above the bars to indicate performance across the 38 countries for that particular indicator. For the well-being indicator, minimum and maximum performance values are displayed as dashed lines on the plot.
The selector()
input arguments for country
and qual_ind
are covered below:
Country | Well-Being Indicator ------------- | ------------- Australia | Dwellings without basic facilities Austria | Educational attainment Belgium | Employees working very long hours Brazil | Employment rate Canada | Feeling safe walking alone at night Chile | Homicide rate Czech Republic | Household net adjusted disposable income Denmark | Household net financial wealth Estonia | Housing expenditure Finland | Labour market insecurity France | Life expectancy Germany | Life satisfaction Greece | Long-term unemployment rate Hungary | Personal earnings Iceland | Quality of support network Ireland | Rooms per person Israel | Self-reported health Italy | Stakeholder engagement for developing regulations Japan | Student skills Korea | Time devoted to leisure and personal care Latvia | Voter turnout Luxembourg | Water quality Mexico | Years in education Netherlands | New Zealand | Norway | Poland | Portugal | Russia | Slovak Republic | Slovenia | South Africa | Spain | Sweden | Switzerland | Turkey | United Kingdom | United States |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.