diff_chr | R Documentation |
Its printed output is similar to calling diff -u
at the command
line.
diff_chr(old, new, max_dist = Inf)
old |
First character vector. |
new |
Second character vector. |
max_dist |
Maximum distance to consider, or |
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 old
after the operation.
new_offset
: offset in new
after the operation.
The diffobj package for a much more comprehensive set of
diff
-like tools.
Other diff functions in cli:
diff_str()
letters2 <- c("P", "R", "E", letters, "P", "O", "S", "T")
letters2[11:16] <- c("M", "I", "D", "D", "L", "E")
diff_chr(letters, letters2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.