Skip to contents

This function compares old and new objects to determine whether they have changed. It ignores the .created_at attribute for all object types. For data frames, the function reports the difference in row counts and column counts (for example, "changed: +10 rows, -2 columns"). For all other object types, the function returns either "unchanged" or "changed".

Usage

dl_detect_change(old, new)

Arguments

old

The original object.

new

The updated object.

Value

A character string describing the change status.

Details

Possible return values:

  • "unchanged": the objects are identical after ignoring .created_at

  • "changed": the objects differ (non–data-frame objects)

  • "changed: +X rows, +Y columns": the data frame gained rows/columns

  • "changed: -X rows, -Y columns": the data frame lost rows/columns

  • "changed: +0 rows, +0 columns": dimensions match but contents differ

Examples

old <- data.frame(a = 1:10)
new <- data.frame(a = 1:15, b = 1:15)
dl_detect_change(old, new)
#> [1] "changed: +5 rows, +1 cols"
# "changed: +5 rows, +1 columns"