Get all the choices labels options for a specific variable if available
Source:R/label_choiceset.R
label_choiceset.Rd
This labeling function ia function factory - https://adv-r.hadley.nz/function-factories.html The output of this function is actually a function
Examples
dico <- kobo_dico( xlsformpath = system.file("sample_xlsform.xlsx", package = "kobocruncher") )
datalist <- kobo_data(datapath = system.file("data.xlsx", package = "kobocruncher") )
data <- kobo_frame(datalist = datalist,
dico = dico,
var = "profile.country" )
label_choiceset(dico = dico,
x="profile.country")(data$profile.country)
#> VEN HND SLV SLV COL
#> "Venezuela" "Honduras" "El Salvador" "El Salvador" "Colombia"
## Test when there's no dictionnary
data$profile.occupation
#> [1] "Consultant" "farmer" "vendor" "teacher" "farmer"
label_choiceset(dico = dico,
x="profile.occupation")(data$profile.occupation)
#> <NA> <NA> <NA> <NA> <NA>
#> "Consultant" "farmer" "vendor" "teacher" "farmer"
label_choiceset(dico = dico,
x="profile.occupation")(data$profile.occupation)
#> <NA> <NA> <NA> <NA> <NA>
#> "Consultant" "farmer" "vendor" "teacher" "farmer"