Skip to contents

Create a dictionary for the labeling results

Usage

create_label_dictionary(
  kobo_survey_sheet,
  kobo_choices_sheet,
  label_column = "label::english",
  analysis_type_dictionary = NULL,
  results_table = NULL
)

Arguments

kobo_survey_sheet

KOBO survey sheet to be used.

kobo_choices_sheet

KOBO choices sheet to be used.

label_column

label column from the KOBO tools to be used.

analysis_type_dictionary

Analysis type dictionary, a data frame with analysis type and label_analysis_type to be used. By default parameters is set to NULL. It will use a default dataframe. See section analysis_type_dictionary for more details.

results_table

result object with an analysis key. Default is NULL, it will be used with review_kobo_labels.

Value

A list with 3 dataframes: dictionary_survey, dictionary_choices, analysis_type_dictionary

analysis_type_dictionary

The default analysis dictionary is created like that.

data.frame(analysis_type = c("prop_select_one",
                             "prop_select_multiple",
                             "mean",
                             "ratio",
                             "median"),
           label_analysis_type = c("Proportion (single choice)",
                                   "Proportion (multiple choice)",
                                   "Mean",
                                   "Ratio",
                                   "Median")

Examples


create_label_dictionary(
  kobo_survey_sheet = presentresults_MSNA2024_kobotool_fixed$kobo_survey,
  kobo_choices_sheet = presentresults_MSNA2024_kobotool_fixed$kobo_choices
)
#> $dictionary_survey
#> # A tibble: 119 × 2
#>    name                        `label::english`                                 
#>    <chr>                       <chr>                                            
#>  1 admin1                      "Admin 1"                                        
#>  2 resp_gender                 "What is your gender?"                           
#>  3 hoh_gender                  "What is the head of household's gender?"        
#>  4 hoh_age                     "How old is the head of household?"              
#>  5 setting                     "Do you live in a in a rural area, urban or peri…
#>  6 hh_size                     "Including yourself, how many people live in thi…
#>  7 aap_priority_challenge      "What are the most significant challenges that y…
#>  8 aap_priority_support_ngo    "What support (if any) would your household like…
#>  9 aap_preferred_modality      "If your household were to receive humanitarian …
#> 10 aap_received_assistance_12m "Has your household received aid in the past 12 …
#> # ℹ 109 more rows
#> 
#> $dictionary_choices
#> # A tibble: 506 × 3
#>    name_survey name_choices `label::english_choices`  
#>    <chr>       <chr>        <chr>                     
#>  1 admin1      PCODE1       To be updated by country 1
#>  2 admin1      PCODE2       To be updated by country 2
#>  3 resp_gender male         Male / man                
#>  4 resp_gender female       Female / woman            
#>  5 resp_gender other        Other                     
#>  6 resp_gender pnta         Prefer not to answer      
#>  7 hoh_gender  male         Male / man                
#>  8 hoh_gender  female       Female / woman            
#>  9 hoh_gender  other        Other                     
#> 10 hoh_gender  pnta         Prefer not to answer      
#> # ℹ 496 more rows
#> 
#> $analysis_type_dictionary
#>          analysis_type          label_analysis_type
#> 1      prop_select_one   Proportion (single choice)
#> 2 prop_select_multiple Proportion (multiple choice)
#> 3                 mean                         Mean
#> 4                ratio                        Ratio
#> 5               median                       Median
#> 


french_dictionary <- data.frame(
  analysis_type = c(
    "prop_select_one",
    "prop_select_multiple",
    "mean",
    "ratio",
    "median"
  ),
  label_analysis_type = c(
    "Proportion (Choix unique)",
    "Proportion (Choix multiple)",
    "Moyenne",
    "Ratio",
    "Médiane"
  )
)

create_label_dictionary(
  kobo_survey_sheet = presentresults_MSNA2024_kobotool_fixed$kobo_survey,
  kobo_choices_sheet = presentresults_MSNA2024_kobotool_fixed$kobo_choices,
  label_column = "label::french",
  analysis_type_dictionary = french_dictionary
)
#> Warning: Duplicated labels, try to the function review_kobo_labels to help
#> $dictionary_survey
#> # A tibble: 119 × 2
#>    name                        `label::french`                                  
#>    <chr>                       <chr>                                            
#>  1 admin1                      Admin 1                                          
#>  2 resp_gender                 Quel est votre genre ?                           
#>  3 hoh_gender                  Quel est le genre du ou de la chef.fe de ménage ?
#>  4 hoh_age                     Quel est l'âge du ou de la chef.fe de ménage ?   
#>  5 setting                     Vivez-vous dans une zone rurale, urbaine ou péri…
#>  6 hh_size                     Combien de personnes, y compris vous-même, viven…
#>  7 aap_priority_challenge      Quels sont les défis les plus importants auxquel…
#>  8 aap_priority_support_ngo    Quel soutien (le cas échéant) votre ménage souha…
#>  9 aap_preferred_modality      Si votre ménage devait recevoir une aide humanit…
#> 10 aap_received_assistance_12m Votre ménage a-t-il bénéficié d'une aide humanit…
#> # ℹ 109 more rows
#> 
#> $dictionary_choices
#> # A tibble: 492 × 3
#>    name_survey name_choices `label::french_choices`    
#>    <chr>       <chr>        <chr>                      
#>  1 admin1      PCODE1       À mettre à jour par le pays
#>  2 admin1      PCODE2       À mettre à jour par le pays
#>  3 resp_gender male         Masculin / homme           
#>  4 resp_gender female       Féminin / femme            
#>  5 resp_gender other        Autre                      
#>  6 resp_gender pnta         Préfère ne pas répondre    
#>  7 hoh_gender  male         Masculin / homme           
#>  8 hoh_gender  female       Féminin / femme            
#>  9 hoh_gender  other        Autre                      
#> 10 hoh_gender  pnta         Préfère ne pas répondre    
#> # ℹ 482 more rows
#> 
#> $analysis_type_dictionary
#>          analysis_type         label_analysis_type
#> 1      prop_select_one   Proportion (Choix unique)
#> 2 prop_select_multiple Proportion (Choix multiple)
#> 3                 mean                     Moyenne
#> 4                ratio                       Ratio
#> 5               median                     Médiane
#>