Skip to contents

This function checks whether the provided Kobo choices dataframe meets certain criteria:

  1. It is a dataframe.

  2. It is not empty.

  3. It contains columns named "list_name" and "name".

Usage

verify_valid_choices(kobo_choices)

Arguments

kobo_choices

A dataframe representing the Kobo choices sheet.

Value

Logical. Returns TRUE if the dataframe meets all the criteria. Otherwise, it returns FALSE.

Examples

# Assume df_valid_choices is a valid Kobo choices dataframe
df_valid_choices <- data.frame(list_name = c("ChoiceA", "ChoiceB"), name = c("Option1", "Option2"))
verify_valid_choices(df_valid_choices) # should return TRUE
#> [1] TRUE

# Assume df_invalid_choices lacks the required columns
df_invalid_choices <- data.frame(column1 = c("ChoiceA", "ChoiceB"),
                                 column2 = c("Option1", "Option2"))
verify_valid_choices(df_invalid_choices) # should return FALSE
#> [1] FALSE