ODK XLSForms link the categorical codings to a variable type name in the 'survey' sheet. The codings are specified in the 'choices' sheet which has a `list_name` column that holds the variable type names. Each row that has that name will be associated with that categorical type coding. This function converts subsets of the choices sheet into individual 'coding' objects.
odk_to_coding(choice_table)
A data.frame slice of the "choices" table from an XLSForm
A `coding` object that corresponds to the choices' slice
[coding_to_odk()]
choice_excerpt <- data.frame(
list_name = rep("yesno", 2),
name = c("Yes", "No"),
label = c(1, 0)
)
odk_to_coding(choice_excerpt)
#> <Coding>
#> # A tibble: 2 × 5
#> link label value description missing
#> <chr> <chr> <dbl> <chr> <lgl>
#> 1 Yes Yes 1 Yes FALSE
#> 2 No No 0 No FALSE