compare_df: Compare Two dataframes

View source: R/fnsComparison.R

compare_dfR Documentation

Compare Two dataframes

Description

Do a git style comparison between two data frames of similar columnar structure

Usage

compare_df(
  df_new,
  df_old,
  group_col,
  exclude = NULL,
  tolerance = 0,
  tolerance_type = "ratio",
  stop_on_error = TRUE,
  keep_unchanged_rows = FALSE,
  keep_unchanged_cols = TRUE,
  change_markers = c("+", "-", "="),
  round_output_to = 3
)

Arguments

df_new

The data frame for which any changes will be shown as an addition (green)

df_old

The data frame for which any changes will be shown as a removal (red)

group_col

A character vector of a string of character vector showing the columns by which to group_by.

exclude

The columns which should be excluded from the comparison

tolerance

The amount in fraction to which changes are ignored while showing the visual representation. By default, the value is 0 and any change in the value of variables is shown off. Doesn't apply to categorical variables.

tolerance_type

Defaults to 'ratio'. The type of comparison for numeric values, can be 'ratio' or 'difference'

stop_on_error

Whether to stop on acceptable errors on not

keep_unchanged_rows

whether to preserve unchanged values or not. Defaults to FALSE

keep_unchanged_cols

whether to preserve unchanged values or not. Defaults to TRUE

change_markers

what the different change_type nomenclature should be eg: c("new", "old", "unchanged").

round_output_to

Number of digits to round the output to. Defaults to 3.


alexsanjoseph/compareDF documentation built on Feb. 1, 2024, 4:46 p.m.