Skip to contents

Creates formatted excel for cleaning log

Usage

create_xlsx_cleaning_log(
  write_list,
  cleaning_log_name = "cleaning_log",
  change_type_col = "change_type",
  column_for_color = "check_binding",
  header_front_size = 12,
  header_front_color = "#FFFFFF",
  header_fill_color = "#ee5859",
  header_front = "Arial Narrow",
  body_front = "Arial Narrow",
  body_front_size = 11,
  use_dropdown = F,
  sm_dropdown_type = NULL,
  kobo_survey = NULL,
  kobo_choices = NULL,
  output_path = NULL
)

Arguments

write_list

List of dataframe

cleaning_log_name

Name for cleaning log from write_list

change_type_col

Change type column name in the cleaning log

column_for_color

Column name in the dataframe which should be used for colorizing the cell. The default is null.

header_front_size

Header front size (default is 12)

header_front_color

Hexcode for header front color (default is white)

header_fill_color

Hexcode for header fill color (default is red)

header_front

Front name for header (default is Arial Narrow)

body_front

Front name for body (default is Arial Narrow)

body_front_size

Front size for body (default is 11)

use_dropdown

Use drop down lists for data validation in the cleaning log output (default is FALSE)

sm_dropdown_type

Dropdown list options for select multiple questions: numerical (1/0) or logical (TRUE/FALSE) - default is logical

kobo_survey

Kobo survey dataframe

kobo_choices

Kobo choices dataframe

output_path

Output path. Default is NULL which will return a workbook instead of an excel file.

Value

save a .xlsx file or return a workbook object

Examples

if (FALSE) {

checks_list <- 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(list_of_log = checks_list) |>
  create_xlsx_cleaning_log()

logical_check_example <- cleaningtools::cleaningtools_raw_data |>
  check_logical(
    check_to_perform = 'treat_cook_water == "always_treat"',
    uuid_column = "X_uuid",
    description = "description",
    check_id = "check_4",
    columns_to_clean = "treat_cook_water"
  )
create_combined_log(logical_check_example) |>
  create_xlsx_cleaning_log(
    output_path = paste0(tempdir(check = TRUE), "/cleaning_log.xlsx"),
    cleaning_log_name = "cleaning_log",
    change_type_col = "change_type",
    kobo_survey = cleaningtools::cleaningtools_survey,
    kobo_choices = cleaningtools::cleaningtools_choices,
    use_dropdown = TRUE,
    sm_dropdown_type = "logical"
  )
}