Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

Compare two strings and look for differences and display them for easy viewing in R (similar to git diff)?

$
0
0

Suppose I have to rather long (>100k character) strings which are mostly identical but differ in some locations.

Git has the concept of a 'diff', which shows only the differences between two (text) files.

Is there anything similar in R, where I can provide two strings and have it return a very 'human readable' excerpt showing only the differences for easily and clear visual inspection?

Desired output

Preferably a simple function call that accepts two (similar) strings as arguments, looks for differences between those two strings, and shows only the parts of the strings that differ, side by side, in either the R console or plot pane.

some_function(first_string, second_string) 

Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>