You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was picturing something more row-based or even rectangular how a git diff might look.
I suppose whether that would help depends on the shape of the data and the nature of the changes. I got thinking about it when I had something where multiple columns in the same row changed and it was tough to see that at a glance from successive prints of the column-based diff.
But you'd have to think carefully about when to use this as (e.g.) it doesn't show changes to the attributes of the data frame, and adding/removing columns doesn't generate particularly informative diffs:
Want to make sure column names are shown whenever there's a diff — need to extract out line-by-line into separate function then provide header arg?
Think about numeric tolerance issues — maybe always compute structure and then use if !same_cols(x, y) or the printed diff is empty? Or double check each column with num_equal() ?
Activity
hadley commentedon May 3, 2021
How could that display be better?
bhogan-mitre commentedon May 3, 2021
I was picturing something more row-based or even rectangular how a git diff might look.
I suppose whether that would help depends on the shape of the data and the nature of the changes. I got thinking about it when I had something where multiple columns in the same row changed and it was tough to see that at a glance from successive prints of the column-based diff.
For example
versus something like
hadley commentedon Jul 13, 2021
One option would be to diff the printed data frame:
Created on 2021-07-13 by the reprex package (v2.0.0)
But you'd have to think carefully about when to use this as (e.g.) it doesn't show changes to the attributes of the data frame, and adding/removing columns doesn't generate particularly informative diffs:
Created on 2021-07-13 by the reprex package (v2.0.0)
I think you'd probably also want to remove columns that are the same:
Created on 2021-07-13 by the reprex package (v2.0.0)
(but probably always force to use the line-by-line diff)
hadley commentedon Jul 13, 2021
Would also need to think through the general problem of columns that print the same but have different underlying values:
Created on 2021-07-13 by the reprex package (v2.0.0)
But that's probably mostly resolved by only using this method if column attributes are the same.
hadley commentedon Jul 14, 2021
!same_cols(x, y)or the printed diff is empty? Or double check each column withnum_equal()?hadley commentedon Jul 14, 2021
Another good case to think about is factor column with same levels but in different order.
hadley commentedon Jul 15, 2021
I think the way around all these challenges is to display the rowwise diff as well as the column based diffs.
hadley commentedon Jul 15, 2021
So this is what the motivating example looks like:
First pass at row-wise diff for data frame s
Implement row-by-row diffs (#90)