Report the values greater than a specified value per specified fields
Source:R/surveybigvalues.R
surveyBigValues.Rd
This function provide a report showing all values which are greater than a certain threshold for a specified list of fields.
Usage
surveyBigValues(
ds = NULL,
questionsSurveyBigValues = NULL,
enumeratorID = NULL,
reportingColumns = c(enumeratorID, uniquerespondantID),
enumeratorCheck = FALSE
)
Arguments
- ds
dataset containing the survey (from kobo): labelled data.frame
- questionsSurveyBigValues
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
questionsSurveyBigValues <-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 <- surveyBigValues(ds = ds,
questionsSurveyBigValues=questionsSurveyBigValues,
enumeratorID=enumeratorID,
reportingColumns=reportingColumns,
enumeratorCheck=FALSE)
knitr::kable(head(result[["ret_log"]], 10))
#>
#>
#> | | enumerator_id|X_uuid | values|ind |
#> |:---|-------------:|:------------------------------------|------:|:-----------------------------------------|
#> |9 | 43|a98f85bc-0752-437d-a513-cc729804c303 | 25000|consent_received.food_security.spend_food |
#> |16 | 16|67324a24-765c-4ed7-bff0-5c739643b21b | 25000|consent_received.food_security.spend_food |
#> |57 | 65|7d6031c7-0dca-476b-89bc-2c5737f0e199 | 30000|consent_received.food_security.spend_food |
#> |209 | 76|48a8986e-f3df-4507-9570-171c1499d123 | 40000|consent_received.food_security.spend_food |
#> |220 | 45|a2656f4d-b3a6-4f2d-b580-2765aca98a37 | 30000|consent_received.food_security.spend_food |
#> |271 | 71|cba3325e-d926-4d83-8fb2-ef8562c898d2 | 30000|consent_received.food_security.spend_food |
#> |279 | 71|a0bfb570-21b0-4e8b-96a6-02d54ef28bff | 30000|consent_received.food_security.spend_food |
#> |280 | 30022|cad17139-8278-4542-ba27-270a31707f80 | 27000|consent_received.food_security.spend_food |
#> |341 | 31|933e2ed6-c556-4a86-9b6d-5f84a1e538ca | 30000|consent_received.food_security.spend_food |
#> |396 | 45|7291bdc3-652c-414a-9f85-a77c998d0fbc | 30000|consent_received.food_security.spend_food |