Skip to contents

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

  1. It is a dataframe.

  2. It is not empty.

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

Usage

verify_valid_survey(kobo_survey)

Arguments

kobo_survey

A dataframe representing the Kobo survey sheet.

Value

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

Examples

# Assume df_valid is a valid Kobo survey dataframe
df_valid <- data.frame(type = c("integer", "selecte_one yesno"), name = c("age", "consent"))
verify_valid_survey(df_valid) # should return TRUE
#> [1] TRUE

# Assume df_invalid lacks the required columns
df_invalid <- data.frame(column1 = c("integer", "selecte_one yesno"), column2 = c("age", "consent"))
verify_valid_survey(df_invalid) # should return FALSE
#> [1] FALSE