l1 = list("x", "y", "z")
l2 = list("X", "Y", "Z", "x", "y", "z")
print("Original lists:")
print(l1)
print(l2)
print("All elements of l2 that are not in l1:")
setdiff(l2, l1)
Sample Output:
[1] "Original lists:"
[[1]]
[1] "x"
[[2]]
[1] "y"
[[3]]
[1] "z"
[[1]]
[1] "X"
[[2]]
[1] "Y"
[[3]]
[1] "Z"
[[4]]
[1] "x"
[[5]]
[1] "y"
[[6]]
[1] "z"
[1] "All elements of l2 that are not in l1:"
[[1]]
[1] "X"
[[2]]
[1] "Y"
[[3]]
[1] "Z"
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer