Skip to contents

Similar to excel_diff, but returns flextable that can be displayed and navigated in the Rstudio viewer. Only shows rows that have changed. For every row with changes, provides a row of before and after, highlighting changed vlaues (red for the value in file_1, green for the value in file_2)."ROWS" column identifies excel row number and columns identify excel column names. Defaults to flagging changes of at least 0.1% from file_1 to file_2 (proportional.diff = TRUE, digits.signif = 3).

Usage

excel_diff_table(
  file_1,
  file_2,
  sheet_name,
  proportional_threshold = 0.001,
  absolute_threshold = NULL,
  digits_show = 6
)

Arguments

file_1

Filename (including path) for first file to compare

file_2

Filename (including path) for second file to compare

sheet_name

Character string of a single excel sheet to compare between the files. (Unlike excel_diff, only one sheet can be compared at a time)

proportional_threshold

Sets a threshold of proportional change below which differences should be ignored. For example, a value of 0.1 means any changes less than 10% will not be flagged as having changed. proportional_threshold will override this value and behavior if it is provided. Numeric, defaults to 0.001 (0.1% change).

absolute_threshold

Optional. Sets a threshold of absolute change below which differences should be ignored. For example, a value of 0.1 means any changes less than 0.1 will not be flagged as having changed. If provided, will override proportional_threshold. Numeric, defaults to NULL.

digits_show

When there is a change in number values, how many digits should be shown in ## ---> ##? Numeric, defaults to 6. Recommend not making this so small that flagged changes don't get printed (e.g., if this is 2 and proportional_threshold is 0.001, 0.1% changes will get flagged, but only the first two digits will get shown).

Value

flextable object.

Examples

if (FALSE) { # \dontrun{
excel_diff_table(
  file_1 = "C:/Repos/test file 1.xlsx",
  file_2 = "C:/Repos/test file 2.xlsx",
  sheet = "Sheet1"
)
} # }