## 1. Install the glossary package:
## https://debruine.github.io/glossary/
library(glossary)
## If you want to use my glossary.yml file:
## 1. fork my repo
## https://github.com/petzi53/glossary-pb
## 2. Download the `glossary.yml` file from
## https://github.com/petzi53/glossary-pb/blob/master/glossary.yml)
## 3. Store the file on your hard disk
## and change the following path accordingly
glossary::glossary_path("../glossary-pb/glossary.yml")
World Happiness Report
Preface
WATCH OUT: This is work in progress
This is my personal learning material and is therefore neither a scientific peer reviewed article nor an authoritative textbook.
With this book I want to explore the data from the World Happiness Reports 2012-2025 using the R language.
I am writing this book as a text for others to read because that forces me to become explicit and explain all my learning outcomes more carefully.
Please keep in mind that this text is not written by an expert but by a learner.
Glossary
I am using the glossary package to create links to glossary entries.
R Code 1 : Load glossary
If you hover with your mouse over the double underlined links it opens an window with the appropriate glossary text. Try this example: WHR.
To apply the glossary into this text I have used the {glossary} package by Lisa DeBruine.
WATCH OUT! No guarantee for correct information in Glossary
There is no guarantee that the glossary text – as well as the whole book – contains correct information. Whenever possible I have mentioned the source of the glossary entry. (You will find active links to the source in the original glossary file at GitHub)
Sometimes I have used abbreviation for the source, but I need still to provide a key what this short references mean.
If you fork the repository of this quarto book then the glossary will not work out of the box. Load down the glossary.yml
file from my glossary-pb GitHub repo, store it on your hard disk and change the path in the code chunk Listing / Output 1.
In any case I am the only responsible person for this text.
R Code
For R code I am using mainly the Tidyverse Style Guide with some additions from Google’s R Style Guide. These additons are:
- Start the names of private functions with a dot.
- Don’t use
base::attach()
. - No right-hand assignments.
- Qualify namespace.
Especially the last point (qualifying namespace) is important for my learning. Besides preventing conflicts with functions of identical names from different packages it helps me to learn (or remember) which function belongs to which package. I think this justifies the small overhead and helps to make R code chunks self-sufficient. (No previous package loading, or library calls in the setup chunk.) To foster learning the relation between function and package I embrace the package name with curly brakes and format it in bold. Additionally I will add a special annex file “Used packages” with an alphabetically sorted list of short package descriptions.
I am mentioning package names explicitly also for the default installation of base R. This wouldn’t be necessary but it helps me to understand where the base R functions come from. What follows is a list of base R packages of the system library included into every installation and attached (opened) by default:
- {base}: The R Base Package
- {datsets}: The R Datasets Package
- {graphics}: The R Graphics Package
- {grDevices}: The R Graphics Devices and Support for Colours and Fonts
- {methods}: Formal Methods and Classes
- {stats}: The R Stats Package
- {utils}: The R Utils Package
But I will not always mention the name of the argument inside a function. When it is clear then I will follow the advice from Hadley Wickham:
When you call a function, you typically omit the names of data arguments, because they are used so commonly. If you overridethe default value of an argument, use the full name (tidyverse style guide).
Resources
Resource 1 : Resources used for this Quarto book
Literature
- Helliwell, J. F., Layard, R., & Sachs, J. D. (Eds.). (2012). World Happiness Report 2012. UN Sustainable Development Solutions Network. https://s3.amazonaws.com/happiness-report/2012/World_Happiness_Report_2012.pdf
- Helliwell, J. F., Layard, R., & Sachs, J. D. (Eds.). (2013). World Happiness Report 2013. UN Sustainable Development Solutions Network. https://s3.amazonaws.com/happiness-report/2013/WorldHappinessReport2013_online.pdf
- Helliwell, J. F., Layard, R., & Sachs, J. D. (Eds.). (2015). World Happiness Report 2015. UN Sustainable Development Solutions Network. https://s3.amazonaws.com/happiness-report/2015/WHR15_Sep15.pdf
- Helliwell, J. F., Layard, R., & Sachs, J. D. (Eds.). (2016). World Happiness Report 2016 Update: Volume I. UN Sustainable Development Solutions Network. https://s3.amazonaws.com/happiness-report/2016/HR-V1_web.pdf
- Sachs, J. D., Becchetti, L., & Annett, A. M. (2016). World Happiness Report 2016: Volume II. Sustainable Development Solutions Network. https://s3.amazonaws.com/happiness-report/2016/HR-V2_web.pdf
- Helliwell, J. F., Layard, R., & Sachs, J. D. (Eds.). (2017). World Happiness Report 2017. UN Sustainable Development Solutions Network. https://s3.amazonaws.com/happiness-report/2017/HR17.pdf
- Helliwell, J. F., Layard, R., & Sachs, J. D. (Eds.). (2018). World Happiness Report 2018. UN Sustainable Development Solutions Network. https://s3.amazonaws.com/happiness-report/2018/WHR_web.pdf
- Helliwell, J. F., Layard, R., & Sachs, J. D. (Eds.). (2019). World Happiness Report 2019. UN Sustainable Development Solutions Network. https://s3.amazonaws.com/happiness-report/2019/WHR19.pdf
- Helliwell, J. F., Layard, R., Sachs, J. D., & Neve, J.-E. D. (Eds.). (2020). World Happiness Report 2020. UN Sustainable Development Solutions Network. https://happiness-report.s3.amazonaws.com/2020/WHR20.pdf
- Helliwell, J. F., Layard, R., Sachs, J. D., Neve, J.-E. D., Aknin, L. B., & Wang, S. (Eds.). (2021). World Happiness Report 2021. UN Sustainable Development Solutions Network. https://happiness-report.s3.amazonaws.com/2021/WHR+21.pdf
- Helliwell, J. F., Layard, R., Sachs, J. D., Neve, J.-E. D., Aknin, L. B., & Wang, S. (Eds.). (2022). World Happiness Report 2022. UN Sustainable Development Solutions Network. https://happiness-report.s3.amazonaws.com/2022/WHR+22.pdf
- Helliwell, J. F., Layard, R., Sachs, J. D., Neve, J.-E. D., Aknin, L. B., & Wang, S. (Eds.). (2023). World Happiness Report 2023. UN Sustainable Development Solutions Network. https://happiness-report.s3.amazonaws.com/2023/WHR+23.pdf
- Helliwell, J. F., Layard, R., Sachs, J. D., Neve, J.-E. D., Aknin, L. B., & Wang, S. (Eds.). (2024). World Happiness Report 2024. University of Oxford: Wellbeing Research Centre. https://happiness-report.s3.amazonaws.com/2024/WHR+24.pdf
- Helliwell, J. F., Layard, R., Sachs, J. D., Neve, J.-E. D., Aknin, L. B., & Wang, S. (Eds.). (2025). World Happiness Report 2025. University of Oxford: Wellbeing Research Centre. https://happiness-report.s3.amazonaws.com/2025/WHR+25.pdf
Websites
- WHR Dashboard
- Analysis: Online chapters of all the yearly online reports 2019-2025.
- World Happiness Report 2025
- World Happiness Report 2024
- World Happiness Report 2023
- World Happiness Report 2022
- World Happiness Report 2021
- World Happiness Report 2020
- World Happiness Report 2019
- World Happiness Report 2018
- World Happiness Report 2017
- World Happiness Report 2016
- World Happiness Report 2015
- World Happiness Report 2013
- World Happiness Report 2012
Icons
- Icon Graphic by Icons8 used for Well-being Statistics. But I have used many other icons by Icons8 for the Quarto callout boxes.
- Favicon.io — The Ultimate Favicon Generator (Free). (n.d.). Retrieved June 26, 2024.
Session Info
Session Info
Code
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.4.3 (2025-02-28)
#> os macOS Sequoia 15.3.2
#> system aarch64, darwin20
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz Europe/Vienna
#> date 2025-04-05
#> pandoc 3.2 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/aarch64/ (via rmarkdown)
#> quarto 1.6.42 @ /usr/local/bin/quarto
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> cli 3.6.4 2025-02-13 [1] CRAN (R 4.4.1)
#> commonmark 1.9.2 2024-10-04 [1] CRAN (R 4.4.1)
#> curl 6.2.1 2025-02-19 [1] CRAN (R 4.4.1)
#> digest 0.6.37 2024-08-19 [1] CRAN (R 4.4.1)
#> evaluate 1.0.3 2025-01-10 [1] CRAN (R 4.4.1)
#> fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.4.1)
#> glossary * 1.0.0 2023-05-30 [1] CRAN (R 4.4.0)
#> here 1.0.1 2020-12-13 [1] CRAN (R 4.4.1)
#> htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.4.1)
#> htmlwidgets 1.6.4 2023-12-06 [1] CRAN (R 4.4.0)
#> jsonlite 1.9.1 2025-03-03 [1] CRAN (R 4.4.1)
#> knitr 1.49 2024-11-08 [1] CRAN (R 4.4.1)
#> markdown 1.13 2024-06-04 [1] CRAN (R 4.4.1)
#> rlang 1.1.5 2025-01-17 [1] CRAN (R 4.4.1)
#> rmarkdown 2.29 2024-11-04 [1] CRAN (R 4.4.1)
#> rprojroot 2.0.4 2023-11-05 [1] CRAN (R 4.4.1)
#> rstudioapi 0.17.1 2024-10-22 [1] CRAN (R 4.4.1)
#> rversions 2.1.2 2022-08-31 [1] CRAN (R 4.4.1)
#> sessioninfo 1.2.3 2025-02-05 [1] CRAN (R 4.4.1)
#> xfun 0.51 2025-02-19 [1] CRAN (R 4.4.1)
#> xml2 1.3.7 2025-02-28 [1] CRAN (R 4.4.1)
#> yaml 2.3.10 2024-07-26 [1] CRAN (R 4.4.1)
#>
#> [1] /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
#> * ── Packages attached to the search path.
#>
#> ──────────────────────────────────────────────────────────────────────────────