Skip to contents

This function provide a report showing all values which are lower than a certain threshold for a specified list of fields.

Usage

surveySmallValues(
  ds = NULL,
  questionsSurveySmallValues = NULL,
  enumeratorID = NULL,
  reportingColumns = c(enumeratorID, uniquerespondantID),
  enumeratorCheck = FALSE
)

Arguments

ds

dataset containing the survey (from kobo): labelled data.frame

questionsSurveySmallValues

columns name from the dataset and value you want to check against (c(col1=value1,col2=value2,...)): named list of integer

enumeratorID

name of the field where the enumerator ID is stored: string

reportingColumns

(Optional, by default it is built from the enumeratorID and the uniquerespondantID) name of the columns from the dataset you want in the result: list of string (c('col1','col2',...))

enumeratorCheck

(Optional, by default set to FALSE) specify if the report has to be displayed for each enumerator or not: boolean (TRUE/FALSE)

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

uniquerespondantID

name of the field where the survey unique ID is stored: 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
questionsSurveySmallValues <-c(consent_received.food_security.spend_food=25000,
                              consent_received.food_security.spend_medication=25000,
                              consent_received.food_security.spend_education=25000,
                              consent_received.food_security.spend_fix_shelter=25000,
                              consent_received.food_security.spend_clothing=25000,
                              consent_received.food_security.spend_hygiene=25000,
                              consent_received.food_security.spend_fuel=25000,
                              consent_received.food_security.spend_hh_items=25000,
                              consent_received.food_security.spend_transport=25000,
                              consent_received.food_security.spend_communication=25000,
                              consent_received.food_security.spend_tobacco=25000,
                              consent_received.food_security.spend_rent=25000,
                              consent_received.food_security.spend_debts=25000,
                              consent_received.food_security.spend_other=25000)
enumeratorID <- "enumerator_id"
uniquerespondantID <- "X_uuid"
reportingColumns <- c(enumeratorID, uniquerespondantID)

result <- surveySmallValues(ds = ds,
                                        questionsSurveySmallValues=questionsSurveySmallValues,
                                        enumeratorID=enumeratorID,
                                        reportingColumns=reportingColumns,
                                        enumeratorCheck=FALSE)
knitr::kable(head(result[["ret_log"]], 10))  
#> 
#> 
#> |   | enumerator_id|X_uuid                               | values|ind                                       |
#> |:--|-------------:|:------------------------------------|------:|:-----------------------------------------|
#> |1  |            52|4e05b9ee-2fb6-4276-ab73-7675e94f5011 |   4000|consent_received.food_security.spend_food |
#> |2  |         10052|3c34b46b-96c4-46aa-9d4f-4147527f9042 |  15000|consent_received.food_security.spend_food |
#> |3  |         10049|b404f0fa-d5ef-4fdf-a217-07509244c1f1 |  10000|consent_received.food_security.spend_food |
#> |5  |            18|3e5ede43-369c-40f6-b59b-c73a5525a81d |   7000|consent_received.food_security.spend_food |
#> |6  |            83|225f1521-c75d-4a4e-b394-0f02ac8e9d8a |  10000|consent_received.food_security.spend_food |
#> |9  |            43|a98f85bc-0752-437d-a513-cc729804c303 |  25000|consent_received.food_security.spend_food |
#> |11 |            91|13d4e232-ba59-4be6-84b4-f5e7d103f549 |  10000|consent_received.food_security.spend_food |
#> |12 |            52|d18cc342-3e4f-46a2-8ed1-cf4c2bb73ab9 |   8000|consent_received.food_security.spend_food |
#> |13 |            45|3f0d915b-7fa6-4262-8783-8d2c477af2e3 |  10000|consent_received.food_security.spend_food |
#> |14 |         30022|93ea674d-29c4-4750-bb48-ce2125a55094 |   7000|consent_received.food_security.spend_food |