Created
December 6, 2019 12:49
-
-
Save darokun/b13794483fdc77d763d5fc39552ff0bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from a tweet I found around, by @WeAreRLadies maybe? | |
x <- 1:4 | |
y <- 3:6 | |
compare <- function(x, y) { | |
list( | |
"These values are in x but not in y" = setdiff(x, y), | |
"These values are in y but not in x" = setdiff(y, x), | |
"These values are shared between x and y" = intersect(x, y), | |
"Combined, x and y return these values" = union(x, y) | |
) | |
} | |
compare(x, y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment