str_diff | R Documentation |
Computes which characters differ between two strings.
str_diff(x, y)
x |
a single string |
y |
a single string |
an integer vector containing the index of all mis-matched characters in the first string.
# strings to compare
x <- "once upon a time"
y <- "once upon a time there was"
z <- "once upon two times"
# diff: x - y
d <- str_diff(x, y)
d
str(d)
# other comparisons
str_diff(y, x)
str_diff(x, x)
str_diff(x, z)
str_diff(y, z)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.