Created
October 13, 2016 14:52
-
-
Save tomatoiscoding/f154369eb0636d3994b1102e1835cfd5 to your computer and use it in GitHub Desktop.
vector intersect and return index
This file contains hidden or 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
| a <- c(1:10) | |
| b <- c(1,3,5,11,12,13,14) | |
| c <- intersect(a, b) | |
| index.a <- match(c, a) # [1] 1 3 5 | |
| index.b <- match(c, b) # [1] 1 2 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment