Skip to contents

Extracts unique list names from the list_name column of all available in-workbook choices sheets. Two sheets are recognised:

Usage

xlsform_defined_list_names(x, ...)

# Default S3 method
xlsform_defined_list_names(x, ...)

# S3 method for class 'xlsform'
xlsform_defined_list_names(x, ...)

Arguments

x

An xlsform object.

...

Ignored; present for S3 method compatibility.

Value

A character vector of unique list names drawn from all available in-workbook choices sheets.

Details

  • choices — the standard sheet used by select_one, select_multiple, and rank.

  • external_choices — the optional sheet used by select_one_external and select_multiple_external. Included automatically when present in the loaded form.

Note on file-based question types

select_one_from_file and select_multiple_from_file reference external CSV/XML/GeoJSON files rather than any in-workbook sheet. This function cannot resolve those references and emits a warning for each such type it encounters.

Difference from xlsform_referenced_list_names()

xlsform_referenced_list_names() returns lists referenced by survey questions; xlsform_defined_list_names() returns lists defined in the choices sheets. The two sets should match for a well-formed form, but can diverge when a question type is changed without updating the choices sheet (or vice versa).

See also

xlsform_referenced_list_names() for list names referenced in the survey sheet; xlsform_choices() for the full choice options per list; validate_list_names() to compare defined lists across two forms.

Examples

form <- read_xlsform(system.file("extdata/form.xlsx", package = "idem"))

# All list names defined in the choices sheet
xlsform_defined_list_names(form)
#>   [1] "l_survey_modality"                           
#>   [2] "l_enum_id"                                   
#>   [3] "l_gender"                                    
#>   [4] "l_admin3"                                    
#>   [5] "l_admin4"                                    
#>   [6] "l_cluster_id"                                
#>   [7] "l_yn"                                        
#>   [8] "l_yn_dnk_pnta"                               
#>   [9] "l_hoh_civil_status"                          
#>  [10] "l_setting"                                   
#>  [11] "l_ind_age_under1"                            
#>  [12] "l_edu_level_grade"                           
#>  [13] "l_edu_barrier"                               
#>  [14] "l_fsl_hhs"                                   
#>  [15] "l_fsl_source_food"                           
#>  [16] "l_fsl_lcsi"                                  
#>  [17] "l_fsl_lcsi_other"                            
#>  [18] "l_fsl_lcsi_en_other"                         
#>  [19] "l_cm_income_source"                          
#>  [20] "cm_income_sources_reduced_1"                 
#>  [21] "cm_income_sources_reduced_2"                 
#>  [22] "l_nut_ind_under5_sick_symptoms"              
#>  [23] "l_nut_ind_under5_sick_location"              
#>  [24] "l_aap_received_assistance_date"              
#>  [25] "l_aap_received_assistance_type"              
#>  [26] "l_snfi_shelter_type"                         
#>  [27] "l_snfi_shelter_type_collective"              
#>  [28] "l_snfi_shelter_type_individual"              
#>  [29] "l_snfi_shelter_damage"                       
#>  [30] "l_snfi_shelter_damage_when"                  
#>  [31] "l_snfi_shelter_damage_cause"                 
#>  [32] "l_snfi_shelter_damage_barriers_repairs"      
#>  [33] "l_snfi_shelter_issue"                        
#>  [34] "l_snfi_fds_cooking"                          
#>  [35] "l_snfi_fds_cooking_issue"                    
#>  [36] "l_snfi_fds"                                  
#>  [37] "l_snfi_fds_sleeping_issue"                   
#>  [38] "l_snfi_fds_storing_issue"                    
#>  [39] "l_snfi_essential_items_missing"              
#>  [40] "l_hlp_threat_eviction"                       
#>  [41] "l_wash_drinking_water_source"                
#>  [42] "l_wash_drinking_water_time_yn"               
#>  [43] "l_wash_drinking_water_time_sl"               
#>  [44] "l_wash_hwise"                                
#>  [45] "l_wash_sanitation_facility"                  
#>  [46] "l_wash_handwashing_facility"                 
#>  [47] "l_wash_handwashing_facility_observed_water"  
#>  [48] "l_wash_soap_observed"                        
#>  [49] "l_wash_handwashing_facility_reported"        
#>  [50] "l_wash_soap_type"                            
#>  [51] "l_health_ind_healthcare_needed_type"         
#>  [52] "l_prot_perceived_risk"                       
#>  [53] "l_prot_perceived_gbv"                        
#>  [54] "l_energy_lighting_source"                    
#>  [55] "l_hlp_occupancy"                             
#>  [56] "l_prot_child_sep_reason"                     
#>  [57] "l_prot_needs_1_services"                     
#>  [58] "l_prot_needs_1_justice"                      
#>  [59] "l_prot_needs_2_activities"                   
#>  [60] "l_prot_needs_2_social"                       
#>  [61] "l_prot_needs_3_movement"                     
#>  [62] "l_cm_expenditure_frequent"                   
#>  [63] "l_cm_expenditure_infrequent"                 
#>  [64] "l_prot_concern_freq_gbv_areas_type"          
#>  [65] "l_prot_concern_impact"                       
#>  [66] "l_prot_child_labour"                         
#>  [67] "l_ch_pr_behaviour_change"                    
#>  [68] "l_admin1"                                    
#>  [69] "l_admin2"                                    
#>  [70] "l_cpa_preferred_modality"                    
#>  [71] "l_priority_support_ngo"                      
#>  [72] "l_aap_relevance_assistance"                  
#>  [73] "l_aap_relevance_assistance_reason"           
#>  [74] "l_aap_satisfaction_assistance"               
#>  [75] "l_aap_assistance_improves_living_conditions" 
#>  [76] "l_aap_assistance_improves_living_challenges" 
#>  [77] "l_cm_market_time"                            
#>  [78] "l_cm_market_barriers_access"                 
#>  [79] "l_cm_market_barriers_purchase"               
#>  [80] "l_dis_forced"                                
#>  [81] "l_dis_area_origin"                           
#>  [82] "l_dis_reasons"                               
#>  [83] "l_ds_plans"                                  
#>  [84] "l_ds_plans_timeline"                         
#>  [85] "l_dis_secondary_n"                           
#>  [86] "l_wgss_difficulty"                           
#>  [87] "l_participation_yes_no"                      
#>  [88] "fsl_livestock_change"                        
#>  [89] "fsl_liv_act"                                 
#>  [90] "fsl_crop_type"                               
#>  [91] "fsl_crop_area_change"                        
#>  [92] "fsl_crop_diff"                               
#>  [93] "fsl_crop_harv_change"                        
#>  [94] "fsl_livestock_type"                          
#>  [95] "fsl_livestock_diff"                          
#>  [96] "fsl_food_storing"                            
#>  [97] "l_edu_other_yn"                              
#>  [98] "l_edu_community_modality"                    
#>  [99] "l_edu_financial_barrier"                     
#> [100] "l_prot_needs_threats"                        
#> [101] "l_prot_needs_populations"                    
#> [102] "l_prot_children_reasons"                     
#> [103] "l_id_yn"                                     
#> [104] "l_prot_id_missing_reason"                    
#> [105] "l_prot_legal_yn"                             
#> [106] "l_prot_legal_barriers"                       
#> [107] "l_prot_adult_sep_reason"                     
#> [108] "l_prot_mines"                                
#> [109] "l_prot_services_availability"                
#> [110] "l_cpa_priority_support_cash"                 
#> [111] "l_aap_satisfaction_challenges"               
#> [112] "l_satisfaction"                              
#> [113] "l_aap_satisfaction_workers_behaviour_reason" 
#> [114] "l_aap_consultation_assistance_opinions"      
#> [115] "l_aap_preferred_means_feedback"              
#> [116] "l_aap_cfm_use"                               
#> [117] "l_aap_information_needs"                     
#> [118] "l_aap_preferred_source_info"                 
#> [119] "l_aap_received_channel_info_aid"             
#> [120] "l_hesper"                                    
#> [121] "l_dis_challenges"                            
#> [122] "l_responsible_chore"                         
#> [123] "l_serious_problem"                           
#> [124] "l_wash_drinking_water_quantity"              
#> [125] "l_wash_drinking_water_acceptable"            
#> [126] "l_wash_water_access_issue"                   
#> [127] "l_wash_person_fetch"                         
#> [128] "l_wash_piped_supply"                         
#> [129] "l_wash_water_availability_yn"                
#> [130] "l_wash_water_availability_issue"             
#> [131] "l_wash_drinking_water_supplied_hours"        
#> [132] "l_wash_drinking_water_store_insufficient_yn" 
#> [133] "l_wash_drinking_water_store_small_containers"
#> [134] "l_wash_drinking_water_treatment"             
#> [135] "l_wash_sanitation_sharing_public"            
#> [136] "l_wash_sanitation_access_features"           
#> [137] "l_wash_sanitation_facility_location"         
#> [138] "l_wash_sanitation_use_toilet_reason"         
#> [139] "l_wash_sanitation_toilet_risks"              
#> [140] "l_wash_sanitation_access_issue"              
#> [141] "l_wash_sanitation_emptied_yn"                
#> [142] "l_wash_sanitation_emptied_where"             
#> [143] "l_wash_sanitation_outlet_pipe"               
#> [144] "l_wash_sanitation_facility_leak"             
#> [145] "l_wash_sanitation_septic_discharge"          
#> [146] "l_wash_sanitation_emptied_who"               
#> [147] "l_wash_sanitation_excreta_released"          
#> [148] "l_wash_sanitation_adaptation"                
#> [149] "l_wash_sanitation_environment"               
#> [150] "l_wash_sanitation_dispose_garbage"           
#> [151] "l_wash_sanitation_dispose_water"             
#> [152] "l_wash_hygiene_menstrual_materials"          
#> [153] "l_wash_hygiene_menstrual_missed_activities"  
#> [154] "l_wash_hygiene_menstrual_issue"              
#> [155] "l_wash_hygiene_menstrual_preferred"          
#> [156] "l_wash_hygiene_menstrual_place"              
#> [157] "l_wash_hygiene_adaptation"                   
#> [158] "l_wash_hygiene_nfi"                          
#> [159] "l_wash_bathing_facility_issue"               
#> [160] "l_sanqol"                                    
#> [161] "l_wash_water_adaptation"                     
#> [162] "l_wash_chl_info_src"                         
#> [163] "l_wash_chl_actions_sick"                     
#> [164] "l_wash_chl_origin"                           
#> [165] "l_wash_chl_transmission"                     
#> [166] "l_wash_chl_health_actions"                   
#> [167] "l_wash_chl_health_practices"                 
#> [168] "l_wash_chl_ors_preparation"                  
#> [169] "l_wash_sanitation_outlet_pipe_where"         
#> [170] "l_health_ind_healthcare_received_location"   
#> [171] "l_health_barriers"                           
#> [172] "l_hazard_env_type"                           
#> [173] "l_hazard_sp_type"                            

# Cross-check: lists defined in choices vs. lists used in survey
# (both should be identical for a well-formed form)
all.equal(
  sort(xlsform_defined_list_names(form)),
  sort(xlsform_referenced_list_names(form))
)
#> [1] "Lengths (173, 171) differ (string compare on first 171)"
#> [2] "137 string mismatches"