diff_chr: Compare two character vectors elementwise
Description
Its printed output is similar to calling diff -u at the command
line.
Usage
diff_chr(old, new, max_dist = Inf)
Value
A list that is a cli_diff_chr object, with a format() and a
print() method. You can also access its members:
old and new are the original inputs,
lcs is a data frame of LCS edit that transform old into new.
The lcs data frame has the following columns:
operation: one of "match", "delete" or "insert".
offset: offset in old for matches and deletions, offset in new
for insertions.
length: length of the operation, i.e. number of matching, deleted
or inserted elements.
old_offset: offset in oldafter the operation.
new_offset: offset in newafter the operation.
Arguments
old
First character vector.
new
Second character vector.
max_dist
Maximum distance to consider, or Inf for no limit.
If the LCS edit distance is larger than this, then the function
throws an error with class "cli_diff_max_dist". (If you specify
Inf the real limit is .Machine$integer.max but to reach this the
function would have to run a very long time.)
See Also
The diffobj package for a much more comprehensive set of
diff-like tools.