Skip to contents

Write the results table of the EQuIS EDD.

Usage

write_results(
  files,
  limits = imdccal::limits,
  qualifiers = imdccal::qualifiers,
  format = c("xlsx", "csv"),
  destination_folder = "./",
  overwrite = FALSE,
  concat = FALSE
)

Arguments

files

Path to .xlsx file delivered by CCAL. Use a character vector to specify multiple files.

limits

Table with detection limits. By default, uses the version in the package. User-defined versions must have the same columns.

qualifiers

Table with flags and their meanings. By default, uses the version in the package. User-defined versions must have the same columns.

format

File format to export machine readable data to - either "xlsx" or "csv"

destination_folder

Folder to save the data in. Defaults to current working directory. Folder must already exist.

overwrite

Overwrite existing file (Defaults to TRUE as with write.table)

concat

If concat is set to TRUE, the function creates one file rather than one for every CCAL deliverable. By default, concat is set to FALSE, so the output contains separate files for each CCAL deliverable. If only one file path is supplied to the files argument, this parameter does not affect the output.

Value

Invisibly returns a list containing the data that were written to file.

Examples

if (FALSE) { # \dontrun{
# Edit limits table to work with example data
limits <- imdccal::limits |>
  dplyr::mutate(EndDate = dplyr::if_else(EndDate == "2024-12-31", lubridate::ymd("2099-12-31"), EndDate))

# Get file paths
all_files <- use_example_data(file_names = use_example_data())

# Write to xlsx
write_results(files = all_files,
              limits = limits,
              destination_folder = "ccal_tidy",
              overwrite = TRUE)  # Write one file of tidied data per input file

# Write to csv
write_results(files = all_files,
              limits = limits,
              format = "csv",
              destination_folder = "ccal_tidy",
              overwrite = TRUE)  # Write one folder of tidied CSV data per input file
} # }