Check the enumerators who pick up less than X answers per specific question
Source:R/enumeratorislazy.R
enumeratorIsLazy.Rd
This function display the enumerators who picked up less than a specified amount of answers per specific question. This can be useful for select_multiple questions where respondent shall give at least 3 options for instance.
Arguments
- ds
dataset containing the survey (from kobo): labelled data.frame
- enumeratorID
name of the field where the enumerator ID is stored: string
- questionsEnumeratorIsLazy
columns name from the dataset and value you want to check against (c(col1=value1,col2=value2,...)): named list of integer the column name is the main part of the name generated by kobo (eg: for the question 'main_income', kobo will generate one TRUE/FALSE column per possible answer as 'main_income.work', 'main_income.remittance'..., only the main part 'main_income' has to be specified here)
- checkperiod
if not null number of day before today when the check should be made
- surveyConsent
name of the field in the dataset where the survey consent is stored: string
- consentForValidSurvey
value defined in the kobo form to acknowledge the surveyed person gave his consent: string
Value
result a list that includes: * dst same dataset as the inputed one but with survey marked for deletion if errors are found and delete=TRUE (or NULL) * ret_log list of the errors found (or NULL) * var a list of value (or NULL) * graph graphical representation of the results (or NULL)
Examples
load(system.file("sample_dataset.RData", package = "HighFrequencyChecks"))
ds <- sample_dataset
enumeratorID <- "enumerator_id"
questionsEnumeratorIsLazy <- c(consent_received.shelter_nfi.non_food_items=3,
consent_received.food_security.main_income=3,
consent_received.child_protection.boy_risk=3,
consent_received.child_protection.girl_risk=3)
result <- enumeratorIsLazy(ds = ds,
enumeratorID=enumeratorID,
questionsEnumeratorIsLazy=questionsEnumeratorIsLazy)
#> Loading required package: DescTools
knitr::kable(head(result[["ret_log"]], 10))
#>
#>
#> | enumeratorID| NbErr|field |
#> |------------:|-----:|:-------------------------------------------|
#> | 1| 2|consent_received.child_protection.girl_risk |
#> | 3| 2|consent_received.child_protection.girl_risk |
#> | 6| 2|consent_received.child_protection.girl_risk |
#> | 12| 6|consent_received.child_protection.girl_risk |
#> | 13| 6|consent_received.child_protection.girl_risk |
#> | 14| 12|consent_received.child_protection.girl_risk |
#> | 16| 9|consent_received.child_protection.girl_risk |
#> | 18| 8|consent_received.child_protection.girl_risk |
#> | 19| 6|consent_received.child_protection.girl_risk |
#> | 24| 6|consent_received.child_protection.girl_risk |