Thanks @Sticks. I can share with you one way to do it using robotoolbox. You can start by going through the introductory vignette and the article on labels. Here is quick example
library(robotoolbox)
library(tidyverse)
library(labelled)
###
url <- "https://kf.kobotoolbox.org"
token <- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx8ae99"
###
kobo_setup(url = url,
token = token)
### uid of the project on kf.kobotoolbox.org
uid <- "aEwTYNcU76UvLgiY89rPWm"
###
data <- kobo_data(uid)
glimpse(data)
## Rows: 95
## Columns: 23
## $ start <dttm> 2022-03-06 16:56:39, 2022-03-06 16:55:02, 2022-0…
## $ end <dttm> 2022-03-07 16:24:54, 2022-03-06 16:56:09, 2022-0…
## $ dima <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
## $ work_loc <chr+lbl> "country_operation", "country_operation", NA,…
## $ ops <chr+lbl> "cod", "cod", NA, NA, NA, "nga", "mli", NA, "…
## $ mco <chr+lbl> NA, NA, NA, NA, NA, NA, NA, "cmr-mco", NA, NA…
## $ bureau <chr+lbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
## $ area <chr+lbl> "none_above", "none_above", NA, NA, NA, "comb…
## $ other_area <chr> "Protection", "Protection", NA, NA, NA, NA, NA, N…
## $ r_knowledge <chr+lbl> "none", "none", NA, NA, NA, "none", "none", "…
## $ stats_background <chr+lbl> "yes", "yes", NA, NA, NA, "yes", "yes", NA, N…
## $ wishlist <chr> NA, "Je souhaite apprendre du logiciel R pour fac…
## $ useful_links <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
## $ `_id` <int> 18529936, 18509567, 18509535, 18509523, 18509508,…
## $ uuid <chr> "f3636e5be98042b1b5535bf580638505", "f3636e5be980…
## $ `__version__` <chr> "v7Dqeq9db9wZSs9rfwkFa9", "v7Dqeq9db9wZSs9rfwkFa9…
## $ instanceID <chr> "uuid:45694127-61f7-43fc-a532-43da1e74018c", "uui…
## $ `_xform_id_string` <chr> "aEwTYNcU76UvLgiY89rPWm", "aEwTYNcU76UvLgiY89rPWm…
## $ `_uuid` <chr> "45694127-61f7-43fc-a532-43da1e74018c", "b2939016…
## $ `_status` <chr> "submitted_via_web", "submitted_via_web", "submit…
## $ `_submission_time` <dttm> 2022-03-07 16:25:05, 2022-03-06 16:56:18, 2022-0…
## $ `_validation_status` <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
## $ `_submitted_by` <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
Now that we have the data, we can use one labelled column and changed a label. We can pick the area column.
## checking the variable without labels
count(data, area)
## # A tibble: 6 × 2
## area n
## <chr+lbl> <int>
## 1 combination [A combination of the above] 5
## 2 im [Information Management] 24
## 3 none_above [None of the above - other functional unit] 21
## 4 odm [Operational Data Management] 15
## 5 registration [Identity Management and Registration] 13
## 6 NA 17
## generating labels using to_character from the labelled package
count(data, area_lbl = to_character(area))
## # A tibble: 6 × 2
## area_lbl n
## <chr> <int>
## 1 A combination of the above 5
## 2 Identity Management and Registration 13
## 3 Information Management 24
## 4 None of the above - other functional unit 21
## 5 Operational Data Management 15
## 6 NA 17
val_labels(data$area)
## Information Management
## "im"
## Identity Management and Registration
## "registration"
## Operational Data Management
## "odm"
## A combination of the above
## "combination"
## None of the above - other functional unit
## "none_above"
Now, let’s change the label of none_above set to None of the above - other functional unit. Let change the label to just None of the above instead of None of the above - other functional unit.
## check the label of the value `none_above`
val_label(data$area, "none_above")
## [1] "None of the above - other functional unit"
## change the label of the value `none_above`
val_label(data$area, "none_above") <- "None of the above"
## check again
val_label(data$area, "none_above")
## [1] "None of the above"
count(data, area_lbl = to_character(area))
## # A tibble: 6 × 2
## area_lbl n
## <chr> <int>
## 1 A combination of the above 5
## 2 Identity Management and Registration 13
## 3 Information Management 24
## 4 None of the above 21
## 5 Operational Data Management 15
## 6 NA 17
robotoolbox relies on the labelled package for value and variable labels manipulation, you can learn more about the labelled package in the intro vignette.
I hope it helps