Description Usage Arguments Value Examples
Execute all loggged cleaning changes
1 2 | execute_cleaning_changes(dir, datasetname = "parent.csv",
logbookname = "cleaning_logbook.csv", uuid_column = NULL)
|
dir |
The directory name of the location where it needs to be saved. |
datasetname |
Name of the dataset. Needs to have a csv extention and be in the <dir> directory. |
logbookname |
Name of the logbook. Default is cleaning_logbook.csv. Needs to have a csv extention and be in the <dir> directory. |
uuid_column |
Name of the UUID column in the dataset. By default (if argument left empty) it will use grep to look for uuid in the column names but if there are no or multiple matches it will give an error. |
Nothing but the cleaned dataset will be saved as <datasetname>_cleaned.csv and the logbook will be overwritten with some comments in the <changed> column. TRUE if it is changed or an error if the question name could not be found.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | dir <- getwd()
extra_columns <- list(population_group = "population_group", governorate = "governorate_mcna")
## Not run:
init_cleaning_log(dir, extra_columns = extra_columns)
data(mcna2019)
require(dplyr)
flag <- mcna2019$num_hh_member - mcna2019$num_family_member < 0
mcna2019[which(flag), c("num_hh_member", "num_family_member")]
uuid <- mcna2019$X_uuid[which(flag)]
log <- log_cleaning(mcna2019, uuid, action = "change", extra_columns = extra_columns,
question.name = "num_hh_member",
issue="Number of family members should always be lower or equal
to household size, but for these it is not.",
new.value = mcna2019$num_family_member[which(flag)], dir = dir)
write.csv(mcna2019, "data.csv", row.names = F)
execute_cleaning_changes(dir, "data.csv", "cleaning_logbook.csv", uuid_column = "X_uuid")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.