Performs symmetric(!) set difference in contrast to setdiff. I.e. given two vectors (of the same mode) the result contains all elements that are either in the first or the second vector but not in both. Duplicated values in the arguments will be discarded.

symdiff(x, y)

Arguments

x

[vector]
Vector containing a sequence of items.

y

[vector]
Another vector containing a sequence of items.

Value

A vector with elements of the symmetric difference of y and y.

Examples

symdiff(1:10, 6:15)
#> [1] 1 2 3 4 5 11 12 13 14 15
symdiff(1:10, 1:20)
#> [1] 11 12 13 14 15 16 17 18 19 20
symdiff(c("a", "b", "c"), c("d", "c", "c", "d", "e"))
#> [1] "a" "b" "d" "e"