diffobj icon indicating copy to clipboard operation
diffobj copied to clipboard

Trim List Indices

Open brodieG opened this issue 7 years ago • 0 comments

Sometimes it may be desirable to match elements that change:

> diffPrint(list(1, 1:4, 5), list(1:4, 1, 5), format="raw")
< list(1, 1..  > list(1:4,..
@@ 1,7 @@      @@ 1,7 @@    
  [[1]]          [[1]]      
< [1] 1        > [1] 1 2 3 4

  [[2]]          [[2]]      
< [1] 1 2 3 4  > [1] 1      

  [[3]]          [[3]]    

The list indices force a sub-optimal content match. Gets tricky when there are named indices that get mixed in, e.g. [[1]]$named[[2]]$also.named. Simple first step would be to trim fully numeric ones.

brodieG avatar Aug 18 '16 12:08 brodieG