As always, first some prep work before we can work on the exercises: Load the packages & the data we need…

library(tidyverse)
library(sjlabelled)

gp_covid <- 
  read_csv2("./data/ZA5667_v1-1-0.csv") %>%
  set_na(na = c(-99, -77, -33, 98))

1

Use across() to recode the trust variables hzcy044a:hzcy052a into dichotomized versions. The value 1 should remain, all others should be 0.
You have to wrap it into the mutate() function and then use recode().

2

Using short pipe and dplyr functions, let’s check if the code worked.
You can combine end your pipe with glimpse() to print the output or use View() to a data tab in RStudio.

3

Use the median() function to calculate an aggregated variable of all trust variables per respondent.
For this task you need to first need to change the data into a row-wise format. For creating the aggregate variable you need the c_across() function. Oh, and don’t forget to ungroup your data at the end (of your pipe).