Skip to contents

Creates a multi-tab report for comparing two data frames with one tab for each element of an object returned by get_comparison()

Usage

create_comparison_excel(
  comparison,
  path = "comparison_report.xlsx",
  autoOpen = FALSE,
  df_names = NULL
)

Arguments

comparison

a list returned from get_comparison()

path

a string, path of the Excel file to be written, default is "comparison_report.xlsx" (must have .xlsx suffix)

autoOpen

a logical indicating whether the Excel file should be automatically opened, default is FALSE

df_names

an optional character vector of length two that provides names for the data frames being compared, the first string in the vector is for df1 and the second string in the vector is for df2. If provided, these names will appear in the Excel 'summary' tab. The default is NULL.

Value

nothing

Examples

id_cols <- c("id1", "id2")
comparison <- get_comparison(compareDFx::df1, compareDFx::df2, id_cols)
#> Warning: ID duplicates detected, recommend fixing these and re-running `get_comparison()`
#> Warning: ID columns contain `NA`, recommend fixing these and re-running `get_comparison()`
#> df1 and df2 have different columns therefore no records are recorded as 'matched'
path <- tempfile(pattern = "comparison_report", fileext = ".xlsx")
create_comparison_excel(comparison, path)