daff icon indicating copy to clipboard operation
daff copied to clipboard

Why are matching (white) rows displayed in render_diff?

Open fabeit opened this issue 3 years ago • 2 comments

From what I understand in the color coding, the color white represents rows which remain unchanged from the source to the target. Why are these displayed by render_diff? And is it possible to not display these rows?

If I select some of these unchanged rows and use them in diff_data I get an empty result, which is correct so I don't understand why they're being displayed when their part of a larger data frame. Thanks

fabeit avatar Nov 18 '22 12:11 fabeit

By default, diff_data provides 1 line before and 1 line after each group of changes. You can change this behavior using the unchanged_context parameter. To avoid showing any unchanged rows, use unchanged_context = 0.

For instance:

iris_minus <- iris[-3,]

render_diff(diff_data(iris, iris_minus))

yields image

while

iris_minus <- iris[-3,]

render_diff(diff_data(iris, iris_minus, unchanged_context = 0))

yields image

warnes avatar Aug 09 '23 21:08 warnes

There is a bug in render_diff that loses the original order of the rows in the comparison table because it gets sorted by the first column.

warnes avatar Aug 09 '23 21:08 warnes