wrp_vignette

Installation

The CRAN release version of worldriskpollr can be installed via:

install.packages("worldriskpollr")

You can install the development version from GitHub with:

# install.packages("devtools")
#devtools::install_github("githubIEP/worldriskpollr")

Once installed you can load the library using:

Introduction

The World Risk Poll is the first ever global study of worry and risk across the world. The poll was conducted by Gallup as part of its World Poll, and is based on interviews with over 150,000 people, including those living in places where little or no official data exists, yet where reported risks are often high.

The World Risk Polls covers the biggest risks faced globally including new findings on subjects such as risks faced by women, safety of food, experience of serious injury and violence and harassment in the workplace, climate change, and online safety.

The poll will enable businesses, regulators, governments and academics to work with communities to develop policies and actions that save lives and make people feel safer. This landmark piece of research will be undertaken at least four times over eight years and the weight of knowledge accumulated will contribute in a more significant way than any past research, to making the world a safer place.

The poll reveals new insights – for example demonstrating that demographic factors are generally a better predictor of risk perception than experience; and new findings that tell us how across the world, different groups of people experience risk in very different ways.

The poll highlights discrepancies between people’s perception of risk and the actual likelihood of them experiencing those dangers. For the first time, we learn how safe people feel; how they perceive risk and what risks they experience everyday.

You can access more details and findings related to the World Risk poll here.

Institute for Economics and Peace

Lloyd’s Register teamed up with the Institute for Economics and Peace (IEP) to explore the complex relationship between peace and people’s perceptions of risk and their safety and security. You can see our latest findings in the annual release of the Global Peace Index In June. Further information about IEP can be found here).

IEP created this package to provide you with easy, programmatic access to the World Risk Poll. We are responsible for maintaining it. We encourage you to reach out to us directly if you have any questions about the package or our broader work measuring trends in peace and security.

Country coverage

The World Risk Poll surveyed people in 150 countries in total, including countries with very low levels of peace where little or no official data exists, yet where reported risks are often high.

Getting started

The worldriskpollr package is designed to give you quick and easy access to all data collected through the World Risk Poll. worldriskpollr provides you with an interactive package to interact and access aggregated survey data.

Using the following functions, it will download and process the World Risk Poll data into your package cache memory, then extract questions of interest.

Getting aggregated World Risk Poll data using wrp_get

The wrp_get function provides users with a way of access aggregated data. Users can select which geographic region they would like to see the data at:

The user also needs to select the desired disaggregation:

Users need to provide the desired aggregation level to wrp_get as a string. It is also necessary to provide a question code string, such as those provided returned in wrp_search. The use of wrp_get looks like:

head(wrp_get(geography = "country", wrp_question_uid = "Q1", disaggregation = 0))
#> # A tibble: 6 × 7
#>   geography     disaggregation group          year question      respo…¹ perce…²
#>   <chr>         <chr>          <chr>         <dbl> <chr>         <chr>     <dbl>
#> 1 United States Aggregate      United States  2019 Feel More, L… More s…  17.9  
#> 2 United States Aggregate      United States  2019 Feel More, L… Less s…  26.7  
#> 3 United States Aggregate      United States  2019 Feel More, L… About …  55.2  
#> 4 United States Aggregate      United States  2019 Feel More, L… (DK)      0.123
#> 5 United States Aggregate      United States  2019 Feel More, L… (Refus…   0.115
#> 6 United States Aggregate      United States  2021 Feel More, L… More s…  16.1  
#> # … with abbreviated variable names ¹​response, ²​percentage

This returns a 6 column dataframe in tidy format with the following columns:

To explore global trends, the user could use:

head(wrp_get(geography = "world", wrp_question_uid = "Q1", disaggregation = 0))
#> # A tibble: 6 × 7
#>   geography disaggregation group  year question                  respo…¹ perce…²
#>   <chr>     <chr>          <chr> <dbl> <chr>                     <chr>     <dbl>
#> 1 World     Aggregate      World  2019 Feel More, Less or About… More s…  36.4  
#> 2 World     Aggregate      World  2019 Feel More, Less or About… Less s…  24.9  
#> 3 World     Aggregate      World  2019 Feel More, Less or About… About …  36.1  
#> 4 World     Aggregate      World  2019 Feel More, Less or About… (DK)      2.44 
#> 5 World     Aggregate      World  2019 Feel More, Less or About… (Refus…   0.148
#> 6 World     Aggregate      World  2021 Feel More, Less or About… More s…  27.3  
#> # … with abbreviated variable names ¹​response, ²​percentage

Standard Use Case

So a standard use case stringing wrp_search and wrp_get together could look like:

# Search for a topic
tmp <- wrp_search("violence")
# Pick the question of interest
tmp <- tmp[tmp$question ==
  "Ever Experienced Physical Violence/Harassment at Work (all countries)", ]
# Get the question code
tmp <- unique(tmp$wrp_question_uid)
# get the data
head(wrp_get(geography = "country", wrp_question_uid = tmp, disaggregation = 0))
#> # A tibble: 6 × 7
#>   geography     disaggregation group          year question      respo…¹ perce…²
#>   <chr>         <chr>          <chr>         <dbl> <chr>         <chr>     <dbl>
#> 1 United States Aggregate      United States  2021 Ever Experie… Yes      11.8  
#> 2 United States Aggregate      United States  2021 Ever Experie… No       88.2  
#> 3 Egypt         Aggregate      Egypt          2021 Ever Experie… Yes       2.12 
#> 4 Egypt         Aggregate      Egypt          2021 Ever Experie… No       63.8  
#> 5 Egypt         Aggregate      Egypt          2021 Ever Experie… (Respo…  33.9  
#> 6 Egypt         Aggregate      Egypt          2021 Ever Experie… (Refus…   0.247
#> # … with abbreviated variable names ¹​response, ²​percentage