edwindj / daff

Diff, patch and merge for data.frames, see http://paulfitz.github.io/daff/
https://edwindj.github.io/daff/
Other
152 stars 18 forks source link

Why are matching (white) rows displayed in render_diff? #33

Open fabeit opened 1 year ago

fabeit commented 1 year ago

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

warnes commented 1 year ago

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 commented 1 year ago

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.