Reporters Without Borders (RWB)

Author

Peter Baumgartner

Published

2025-08-14 10:13

Preface

This is work in progress

I have finished approximately 5%. This is just a rough guess, derived from my Project plan.

Currently I am working on plotting the map for the RWB datasets 2022-2025.

Content and Goals of this Book

I am writing this book to learn how to develop a Shiny Dashboard. It is a practical project to support my understanding of Mastering Shiny (Wickham 2021). It was helpful that I have written down during reading Mastering Shiny personal notes in Learning Shiny. But this was mostly only a replication exercise. With this project I am trying to develop my practical skills in building Shiny apps.

WATCH OUT: I am a learner not an expert

I am writing this book as a text for others to read because that forces me to become explicit and explain all my considerations and my code lines more carefully. Please keep in mind that this text is not written by an expert but by a learner.

I have some experience with data wrangling using the {tidyverse}. But it is important to stress that I have almost no experience with Shiny apps and much less with building an interactive Dashboard. At the moment (August 2025) I haven’t read neither Engineering Production-Grade Shiny Apps (Fay et al. 2021) nor Outstanding User Interfaces with Shiny (Granjon 2022). So my theoretical and practical knowledge is very limited. Therefore this Quarto book my contain many mistakes. If you find misapprehensions, errors or just better ways to solve my intentions feel free to drop me a note in the GitHub repo of this book.

World Press Freedom Index

I decided to develop a dashboard for the dataset on the World Press Freedom Index (WPFI) for this practical learning project. The WPFI was developed by Reporters Without Borders (RWB) (French: Reporters sans frontières) (RSF).

The World Press Freedom Index (WPFI) is an annual ranking of countries compiled and published by Reporters Without Borders (RSF) since 2002 based upon the non-governmental organization’s own assessment of the countries’ press freedom records in the previous year. It intends to reflect the degree of freedom that journalists, news organizations, and netizens have in each country, and the efforts made by authorities to respect this freedom. Reporters Without Borders notes that the WPFI only deals with press freedom and does not measure the quality of journalism in the countries it assesses, nor does it look at human rights violations in general. (Wikipedia)

Index construction has changed

It is important to note that the questionnaire as well the method to construct the index has changed several times.

  • From 2022-2012 (2011 is missing): The global index comprises the following components (see Questionnaire for compiling the 2010 Press Freedom Index)
    • Physical violence
    • Number of journalists murdered, detained, physically attacked or threatened, and the role of authorities in this
    • Indirect threats, harassment and access to information
    • Censorship and self-censorship
    • Control of media
    • Judicial, business, and administrative pressure
    • Internet and new media
    • Are there any points not included in this questionnaire that might be relevant forassessing the press freedom situation in your country? Please mention them.
  • From 2013-2021: The global index comprises the following components (see RSF SURVEY 2016)
    • Pluralism: Measures the degree to which opinions are represented in the media.
    • Media independence: Measures the degree to which the media are able to function independently of sources of political, governmental, business and religious power and influence.
    • Environment and self-censorship: Analyses the environment in which news and information providers operate.
    • Legislative framework: Measures the impact of the legislative framework governing news and information activities.
    • Transparency: Measures the transparency of the institutions and procedures that affect the production of news and information.
    • Infrastructure: Measures the quality of the infrastructure that supports the production of news and information.
    • Abuses: Measures the level of abuses and violence, based on data gathered about abuses and acts of violence against journalists and media during the period evaluated.
  • From 2022 onwards: The global index comprises the following components (see World Press Freedom Index: Questionnaire 2022). This is a major overhaul using a questionnaire of 12 pages with 118 questions comprising five contextual components (Details here):
    • Political context (35 questions)
    • Legal framework (26 questions)
    • Economic context (26 questions)
    • Sociocultural context (22 questions)
    • Safety (15 questions = 2/3 of the safety score and 1 question of abuse = 1/3 of the safety score)

Scores comparison

  • The scores from 2002 - 2012 are not explicated, the unlimited range starts from 0 — the best — to over 100 — 115.5 in 2009 (Eritrea) is the worst.
  • From 2013 onwards the scores are limited from 100 (the ideal country) to 0 (the imaginable worst country) points.
  • From 2022 onwards exist different criteria where each component itself has a range from 100 to 0.

These three score methods are not comparable. One way to compare the different years from 2002-2025 is the rank, with the caveat that in the earlier year there are many ties. Another one could be elicited by the five categories using map colors. Starting with 2005 there are colored maps with five colors. But a detailed inspection reveals that the scores and map colors does not match.

Although the score ranges between 2013 and 2025 change with 2021 onwards the content of the categories remain constant. We could therefore compare these countries not only with their global score but also in five sub-categories:

2022-2025

  • [85 - 100 points] : good (green)
  • [70 - 85 points[ : satisfactory (yellow)
  • [55 - 70 points[ : problematic (light orange)
  • [40 - 55 points[ : difficult (dark orange)
  • [0 - 40 points[ : very serious (dark red)

2013-2021

  • [85 ; 100 points] : good (green)
  • [75 ; 85 points[ : satisfactory (yellow)
  • [65 ; 75 points[ : problematic (light orange)
  • [45 ; 65 points[ : difficult (dark orange)
  • [0 ; 45 points[ : very serious (dark red)

It is symptomatic that the borders for the different categories have been relaxed from 2022 onwards. We will have a look on these differences later to judge if the general distribution of scores has changed (worsened), so that the adaption was made to get similar numbers of countries in each category. But it could also the case that the different sub-criteria after 2021 required this slight adaption. Another reason could be to set the four upper categories to the same range (all have 15 points), whereas they differ between 2013-2021 (20, 10, 10, 15 points).

Although the index construction from 2013 to today has changed in 2022 we can compare not only the ranks but also the amount of points as all these years have the same scale of 0-100 points.

Project plan

I take as a model for my practical project the Word Happiness Report (WHR) dashboard. I cannot plan the details but my dashboar should contain the following main visualizations:

Maps

The start of the dashboard should be a map from the last year where data are available. This is currently 2025. It should be a map quite similar as it is in the original website at https://rsf.org/en/index. As in the original it should also reveal country information whenever the mouse is hovering over a specific country.

The differences to the start view are:

  • A legend that explains the different colors
  • A filter that shows different years and regions
  • A button to download the image with the legend and creative comms copyright information (CC-BY-SA 4.0)
  • At the sidebar you can select which variable to show: Global score (start), political, economic, legal, social, and safety.

To compare with my WHR model see the WHR Map.

Charts

(Looking for a better name, as the ranking graphics are also charts.)

The charts should show the development by year for the

  • global score: Data 2013-2025
  • five components: 2022-2025

Additionally you can

  • select a country or regional category to add to the chart
  • deselect a country or regional category
  • When a region was selected then there should a possibility to show a list of the countries for every region.
  • Additionally there should also the possibility to show the mean/median by country or better by population of the region.

I am thinking of Connected Scatterplots as graphical device to show the development over the years.

To compare with my WHR model see the WHR Chart.

Rankings

The charts should show the ranking development of countries / regions by year for the

  • global score: Data 2002-2025
  • five components: Data 2022-2025

I am thinking of Lollipop Plots and/or Bump Charts as a graphical devices to show the development of ranks.

Similar to the charts you should also be able to

  • select a country or regional category to add to the chart
  • deselect a country or regional category
  • When a region was selected then there should a possibility to show a list of the countries for every region.

My WHR model has only a list of ranked countries without any visualization.

Countries

Choosing one country or regions displays a summary of all available data for this item. This could be:

  • Evolution of the six different scores over the years with a Connected Scatterplot.
  • Evolution of the rankings for the six different scores over the years with a Bump Chart.
  • Additional information about the country / region displayed with value boxes and more.

Realization

I will apply the intermediate results of my code development parallel the Shiny package RSF (Reporters sans frontières). After some research I learned that the {bslib} package is the most modern package fpr dashboard development. I looked into

{bslib} is now the recommendation for Shiny dashboards. See Towards easy, delightful, and customizable dashboards in Shiny for R with {bslib} and {bslib} Dashboardes. The “Mastering Shiny” book does not use {bslib} for its example code. Although I had experimented a little bit with {bslib} I still have to learn to apply the {bslib} package.

An interesting intermediate solution could also trying to apply {flexdashboard} to get a first flavor of my results. I don’t know if this is a viable option because I have never used {flexdashboard} so far.

Glossary

I am using the {glossary} package to create links to glossary entries.]

R Code 1 : Load glossary

Listing / Output 1: Install and load the glossary package with the appropriate glossary.yml file
Code
## 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")

If you hover with your mouse over the double underlined links it opens an window with the appropriate glossary text. Try this example: RWB.

WATCH OUT! Glossary is my private learning vehicle

I have added many of the glossary entries when I was working through other books either taking the text passage of these books I was reading or via an internet recherche from other resources. Sometimes I have added the source of the glossary entry as an abbreviation or as an URL. Many definitions were provided by the KI provided within the search of my Brave browser.

If you fork the repo of this 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 accordingly.

In any case I am the only responsible person for the glossary text, especially if I have used text from other resources wrongly. Again: The main purpose of the glossary is to support my personal learning venture.

R Code and Datasets

During coding I am following the Tidyverse Style Guide. But for learning purposes I am trying to prefix all functions with the package name in the format :: (e.g., dplyr::filter()) This is an overhead but supports me to understand which packages is responsible for which action.

Sometimes adding just the package name does not work. This is mostly the case when a generic function name like plot is used by another package in a more specialized manner. In this case I will try to use the function of the package. If this doesn’t work too then I have to come back to the standard usage of base::library(<package-name>).

I am using the package name 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

I am not using always the exact code snippets for my replications because I am not only replicating the code to see how it works but also to change the values of parameters to observe their influences.

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 override the default value of an argument, use the full name (tidyverse style guide).

I am not using code annotation because it disables code linking and does not show up correctly in the pop-up window generated with listing cross references.

Annex

In some of my book notes I provide files in the annex. They contain experiments not directly in line with the book but inspired by my reading of the book.

Often you will also find an annex file with a standardized short description of all my used packages, sometimes added with notes about my personal experiences with this package. An example of the standardized format gives you the following Glossary package.

Glossary package

Package Profile: glossary

{glossary}: Glossaries for Markdown and Quarto Documents (DeBruine 2023)

Add glossaries to markdown and quarto documents by tagging individual words. Definitions can be provided inline or in a separate file.

There is a lot of necessary jargon to learn reading new books. The goal of {glossary} is to provide a lightweight solution for making glossaries in educational materials written in quarto or R Markdown. This package provides functions to link terms in text to their definitions in an external glossary file, as well as create a glossary table of all linked terms at the end of a section.


In the meantime {glossary} is for me a very important learning vehicle. Whenever an expression appears with a doubled underlined link I know that I will get more information by hovering the mouse over the underlined text.

There is a little inconvenience with abrreviation that could also be part of another glossary entry text string (e.g., API and Capital Income). My workaround is to end the short abbreviation with an additional ‘x’ and then to call the glossary with the x-version follwed by the text that should be appear in the document (e.g., r glossary(“APIx”, “API”)). This double format is a standard feature of the {glossary} package so that you can adapt the appearing text to the glossary entry (e.g., singular/plural or other grammar changes).

Resources

Resource 1 : Resources used for this Quarto book

XXX: [ADD HERE USED ADDITIONAL SOURCES]

Private Functions

XXX: [DESCRIBE PRIVATE FUNCTION USED IN THIS BOOK]

Glossary Entries of this Chapter

term definition
APIx An API, or application programming interface, is a set of defined rules that enable different applications to communicate with each other. It acts as an intermediary layer that processes data transfers between systems, letting companies open their application data and functionality to external third-party developers, business partners, and internal departments within their companies. (<a href="https://www.ibm.com/topics/api">IBM</a>)
Capital Income Capital income is defined as the sum of property income, including dividends, interest gains, reinvested earnings on foreign direct investment, investment income disbursements and land rents ([Distributional National Accounts (DINA) for Austria, 2004-2016](https://wid.world/document/distributional-national-accounts-dina-for-austria-2004-2016-world-inequality-lab-wp-2020-23/)).
RWB Reporters Without Borders (RWB), known by its French name Reporters sans frontières and acronym RSF, is an international non-profit and non-governmental organization headquartered in Paris, France, founded in 1985 in Montpellier by journalists Robert Ménard, Rémy Loury, Jacques Molénat, and Émilien Jubineau. It is dedicated to safeguarding the right to freedom of information and defends journalists and media personnel who are imprisoned, persecuted, or at risk for their work. The organization has consultative status at the United Nations, UNESCO, the Council of Europe, and the International Organisation of the Francophonie.
WHR The World Happiness Reports are a partnership of Gallup, the Oxford Wellbeing Research Centre, the UN Sustainable Development Solutions Network, and the WHR’s Editorial Board. The report is produced under the editorial control of the WHR Editorial Board. The Reports reflects a worldwide demand for more attention to happiness and well-being as criteria for government policy. It reviews the state of happiness in the world today and shows how the science of happiness explains personal and national variations in happiness. (https://worldhappiness.report/about/)
WPFI The World Press Freedom Index (WPFI) is an annual ranking of countries compiled and published by Reporters Without Borders (RSF), an international non-governmental organization based in France, since 2002. It aims to reflect the degree of freedom that journalists, news organizations, and netizens have in each country, as well as the efforts made by authorities to respect this freedom. The index ranks 180 countries and territories based on RSF's assessment of their press freedom records in the preceding year.

Session Info

Session Info

Code
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.5.1 (2025-06-13)
#>  os       macOS Sequoia 15.6
#>  system   aarch64, darwin20
#>  ui       X11
#>  language (EN)
#>  collate  en_US.UTF-8
#>  ctype    en_US.UTF-8
#>  tz       Europe/Vienna
#>  date     2025-08-14
#>  pandoc   3.7.0.2 @ /opt/homebrew/bin/ (via rmarkdown)
#>  quarto   1.8.4 @ /usr/local/bin/quarto
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package      * version    date (UTC) lib source
#>  cli            3.6.5      2025-04-23 [1] CRAN (R 4.5.0)
#>  commonmark     2.0.0      2025-07-07 [1] CRAN (R 4.5.0)
#>  curl           6.4.0      2025-06-22 [1] CRAN (R 4.5.0)
#>  dichromat      2.0-0.1    2022-05-02 [1] CRAN (R 4.5.0)
#>  digest         0.6.37     2024-08-19 [1] CRAN (R 4.5.0)
#>  evaluate       1.0.4      2025-06-18 [1] CRAN (R 4.5.0)
#>  farver         2.1.2      2024-05-13 [1] CRAN (R 4.5.0)
#>  fastmap        1.2.0      2024-05-15 [1] CRAN (R 4.5.0)
#>  glossary     * 1.0.0.9003 2025-06-08 [1] local
#>  glue           1.8.0      2024-09-30 [1] CRAN (R 4.5.0)
#>  htmltools      0.5.8.1    2024-04-04 [1] CRAN (R 4.5.0)
#>  htmlwidgets    1.6.4      2023-12-06 [1] CRAN (R 4.5.0)
#>  jsonlite       2.0.0      2025-03-27 [1] CRAN (R 4.5.0)
#>  kableExtra     1.4.0      2024-01-24 [1] CRAN (R 4.5.0)
#>  knitr          1.50       2025-03-16 [1] CRAN (R 4.5.0)
#>  lifecycle      1.0.4      2023-11-07 [1] CRAN (R 4.5.0)
#>  litedown       0.7        2025-04-08 [1] CRAN (R 4.5.0)
#>  magrittr       2.0.3      2022-03-30 [1] CRAN (R 4.5.0)
#>  markdown       2.0        2025-03-23 [1] CRAN (R 4.5.0)
#>  R6             2.6.1      2025-02-15 [1] CRAN (R 4.5.0)
#>  RColorBrewer   1.1-3      2022-04-03 [1] CRAN (R 4.5.0)
#>  rlang          1.1.6      2025-04-11 [1] CRAN (R 4.5.0)
#>  rmarkdown      2.29       2024-11-04 [1] CRAN (R 4.5.0)
#>  rstudioapi     0.17.1     2024-10-22 [1] CRAN (R 4.5.0)
#>  rversions      2.1.2      2022-08-31 [1] CRAN (R 4.5.0)
#>  scales         1.4.0      2025-04-24 [1] CRAN (R 4.5.0)
#>  sessioninfo    1.2.3      2025-02-05 [1] CRAN (R 4.5.0)
#>  stringi        1.8.7      2025-03-27 [1] CRAN (R 4.5.0)
#>  stringr        1.5.1      2023-11-14 [1] CRAN (R 4.5.0)
#>  svglite        2.2.1      2025-05-12 [1] CRAN (R 4.5.0)
#>  systemfonts    1.2.3      2025-04-30 [1] CRAN (R 4.5.0)
#>  textshaping    1.0.1      2025-05-01 [1] CRAN (R 4.5.0)
#>  vctrs          0.6.5      2023-12-01 [1] CRAN (R 4.5.0)
#>  viridisLite    0.4.2      2023-05-02 [1] CRAN (R 4.5.0)
#>  xfun           0.52       2025-04-02 [1] CRAN (R 4.5.0)
#>  xml2           1.3.8      2025-03-14 [1] CRAN (R 4.5.0)
#>  yaml           2.3.10     2024-07-26 [1] CRAN (R 4.5.0)
#> 
#>  [1] /Library/Frameworks/R.framework/Versions/4.5-arm64/library
#>  [2] /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library
#>  * ── Packages attached to the search path.
#> 
#> ──────────────────────────────────────────────────────────────────────────────

References

DeBruine, Lisa. 2023. “Glossary: Glossaries for Markdown and Quarto Documents.” https://github.com/debruine/glossary.
Fay, Colin, Sébastien Rochette, Vincent Guyader, and Cervan Girard. 2021. Engineering Production-Grade Shiny Apps: A Workflow. Boca Raton, FL: Chapman; Hall/CRC.
Granjon, David. 2022. Outstanding User Interfaces with Shiny. Boaca Raton London New York: Chapman; Hall/CRC.
Wickham, Hadley. 2021. Mastering Shiny: Build Interactive Apps, Reports, and Dashboards Powered by R. O’Reilly UK Ltd.