set_diff | R Documentation |
Function for testing for unique values between two vectors, specifically, which values are in vector1, and not in vector2, which values are not in vector1 and in vector2, which values are in both vector1 and vector2.
set_diff(x, y)
x , y |
vectors (of the same mode) |
a qwraps2_set_diff object, a list of set comparisons
all_values
= union(x, y)
x_only
= setdiff(x, y)
y_only
= setdiff(y, x)
both
= intersect(x, y)
equal
= setequal(x, y)
# example with two sets which as a union are the upper and lower case vowels.
set_a <- c("A", "a", "E", "I", "i", "O", "o", "U", "u", "E", "I")
set_b <- c("A", "a", "E", "e", "i", "o", "U", "u", "u", "a", "e")
set_diff(set_a, set_b)
str(set_diff(set_a, set_b))
set_diff(set_b, set_a)
# example
set_a <- 1:90
set_b <- set_a[-c(23, 48)]
set_diff(set_a, set_b)
set_diff(set_b, set_a)
# example
set_a <- c("A", "A", "B")
set_b <- c("B", "A")
set_diff(set_a, set_b)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.