Skip to contents

Create logical checks for "other" values.

Usage

create_logic_for_other(
  kobo_survey,
  sm_separator = ".",
  compare_with_dataset = FALSE,
  dataset = NULL
)

Arguments

kobo_survey

Kobo survey sheet.

sm_separator

Separator for choice multiple questions. The default is "."

compare_with_dataset

Default FALSE will not compare the applicability of logics with the dataset whereas TRUE will check the applicability of logics.

dataset

dataset to be checked.

Value

A dataframe will all logical tests to check "others" value. It should be used in combination of review_others

Examples

create_logic_for_other(
  kobo_survey = cleaningtools::cleaningtools_survey,
  sm_separator = ".",
  dataset = cleaningtools::cleaningtools_clean_data,
  compare_with_dataset = TRUE
)
#> Warning: The following parent names: well_quality, spring_quality, rainwater_quality, surface_quality, why_not_connected were not found in the dataset. The function is ignoring them.
#> # A tibble: 47 × 4
#>    id     logic                               description variables_to_clean_c…¹
#>    <chr>  <chr>                               <chr>       <chr>                 
#>  1 id- 1  "(`water_sources.other` == TRUE | … water_sour… water_sources.other   
#>  2 id- 2  "water_source_drinking == \"other\… water_sour… water_source_drinking 
#>  3 id- 3  "(`treat_drink_water_how.other` ==… treat_drin… treat_drink_water_how…
#>  4 id- 4  "water_source_cook == \"other\""    water_sour… water_source_cook     
#>  5 id- 5  "(`treat_cook_water_how.other` == … treat_cook… treat_cook_water_how.…
#>  6 id- 6  "(`piped_quality.no_other` == TRUE… piped_qual… piped_quality.no_other
#>  7 id- 7  "(`tap_quality.no_other` == TRUE |… tap_qualit… tap_quality.no_other  
#>  8 id- 8  "(`borehole_quality.no_other` == T… borehole_q… borehole_quality.no_o…
#>  9 id- 9  "(`trucking_quality.no_other` == T… trucking_q… trucking_quality.no_o…
#> 10 id- 10 "water_source_bath == \"other\""    water_sour… water_source_bath     
#> # ℹ 37 more rows
#> # ℹ abbreviated name: ¹​variables_to_clean_column