I need to check and find info by comparing columns from 2 different data.frames.
Lets imagine these 2 data.frames:
data.frame(stringsAsFactors=FALSE,
Trajectory = c("%%EEE_!AAAA", "!AAAB_NICAR", "GIKIN_NICAR", "!AAAA_!AAAB"),
Trajectory = c("%%EEE_!AAAA", "!AAAB_NICAR", "GIKIN_NICAR", "!AAAA_!AAAB")
)
data.frame(stringsAsFactors=FALSE,
Segment = c("!AAAB_NICAR", "!AAAC_$$FF", "GIKIN_NICAR", "!AAAA_!AAAA"),
Segment = c("!AAAB_NICAR", "!AAAC_$$FF", "GIKIN_NICAR", "!AAAA_!AAAA")
)
In this example, when looking for Trajectory names into Segment names, some of then shouldn't be found, those are: %%EEE_!AAAA and !AAAA_!AAAB.
What I want the code to do for me is to search Trajectory names into Segment names and create a new data.frame with the non-found names and the found ones (call Mached). In the example above, the new data.frame would be:
data.frame(stringsAsFactors=FALSE,
Non_Found = c("%%EEE_!AAAA", "!AAAA_!AAAB"),
Mached = c("!AAAB_NICAR", "GIKIN_NICAR")
)