Skip to contents

Add information to the cleaning log

Usage

add_info_to_cleaning_log(
  list_of_log = NULL,
  dataset = "checked_dataset",
  cleaning_log = "cleaning_log",
  dataset_uuid_column = "uuid",
  cleaning_log_uuid_column = "uuid",
  information_to_add = c("enumerator_num", "date_assessment")
)

Arguments

list_of_log

A list file containing the cleaning_log and the dataset

dataset

If a list is provided, the element name represents the dataset; otherwise, it should be a dataframe.

cleaning_log

If a list is provided, the element name represents the cleaning log; otherwise, it is should be a dataframe.

dataset_uuid_column

uuid column in the cleaning dataset, it can take a vector of several binding key. Default is uuid.

cleaning_log_uuid_column

uuid column in the cleaning log, it can take a vectore of several binding key. Default is uuid.

information_to_add

Vector of name of the columns to be added.

Value

A list with cleaning log with added info and the dataset.

Examples

cleaningtools::cleaningtools_raw_data |>
  check_pii(uuid_column = "X_uuid") |>
  check_duplicate(uuid_column = "X_uuid") |>
  check_value(uuid_column = "X_uuid") |>
  create_combined_log() |>
  add_info_to_cleaning_log(dataset_uuid_column = "X_uuid")
#> List of element to combine- checked_dataset, potential_PII, duplicate_log, flaged_value
#> $checked_dataset
#> # A tibble: 632 × 348
#>    X.U.FEFF.start    end   date_assessment deviceid enumerator_num neighbourhood
#>    <chr>             <chr> <chr>           <chr>             <int> <chr>        
#>  1 2021-07-05T10:58… 2021… 2021-07-05      collect…             13 A2           
#>  2 2021-07-05T10:08… 2021… 2021-07-05      collect…             13 A2           
#>  3 2021-07-05T11:22… 2021… 2021-07-05      collect…              8 A2           
#>  4 2021-07-04T22:22… 2021… 2021-07-04      collect…             15 A2           
#>  5 2021-07-04T23:11… 2021… 2021-07-04      collect…             15 A2           
#>  6 2021-07-05T10:17… 2021… 2021-07-05      collect…             14 A2           
#>  7 2021-07-05T11:38… 2021… 2021-07-05      collect…              4 A4           
#>  8 2021-07-05T11:01… 2021… 2021-07-05      collect…             16 A2           
#>  9 2021-07-05T11:45… 2021… 2021-07-05      collect…             16 A2           
#> 10 2021-07-05T10:19… 2021… 2021-07-05      collect…              8 A2           
#> # ℹ 622 more rows
#> # ℹ 342 more variables: consent_remote <chr>, hhh_r <chr>,
#> #   will_to_response_r <chr>, age_respondent_r <int>, age_hoh <int>,
#> #   gender_hoh <chr>, displace_status <chr>, displace_status_returnee <chr>,
#> #   return_date <chr>, num_hh_member <int>, hh_hosting <chr>,
#> #   num_hh_hosting <int>, hh_hosted <chr>, shelter_occupation <chr>,
#> #   shelter_occupation_other <chr>, property_title <chr>, …
#> 
#> $cleaning_log
#>                                   uuid                              question
#> 1 ac26e24d-12be-4729-bae7-21060ee00a28                               X_index
#> 2                                  all                         neighbourhood
#> 3                                  all       water_supply_rest_neighbourhood
#> 4                                  all     water_supply_other_neighbourhoods
#> 5                                  all water_supply_other_neighbourhoods_why
#> 6                                  all              consent_telephone_number
#> 7 e8b1ba82-59df-4910-b9c8-29bc3fd516ab                               X_index
#>                                issue old_value change_type new_value
#> 1 Possible value to be changed to NA        88        <NA>      <NA>
#> 2                      Potential PII      <NA>        <NA>      <NA>
#> 3                      Potential PII      <NA>        <NA>      <NA>
#> 4                      Potential PII      <NA>        <NA>      <NA>
#> 5                      Potential PII      <NA>        <NA>      <NA>
#> 6                      Potential PII      <NA>        <NA>      <NA>
#> 7 Possible value to be changed to NA        99        <NA>      <NA>
#>                                      check_binding enumerator_num
#> 1 X_index ~/~ ac26e24d-12be-4729-bae7-21060ee00a28             13
#> 2                            neighbourhood ~/~ all             NA
#> 3          water_supply_rest_neighbourhood ~/~ all             NA
#> 4        water_supply_other_neighbourhoods ~/~ all             NA
#> 5    water_supply_other_neighbourhoods_why ~/~ all             NA
#> 6                 consent_telephone_number ~/~ all             NA
#> 7 X_index ~/~ e8b1ba82-59df-4910-b9c8-29bc3fd516ab              9
#>   date_assessment
#> 1      2021-07-06
#> 2            <NA>
#> 3            <NA>
#> 4            <NA>
#> 5            <NA>
#> 6            <NA>
#> 7      2021-07-07
#>