I need to find info from a data.frame into another data.frame and identify the data as FOUND and NOT FOUND.
Let's call 1st data.frame "conflict" and 2nd "segment". Each data.frame has 2 columns: ID1 and ID2. When info from "conflict" is searched in "segment" both ID1 and ID2 from a row has to be found to not be identified as FOUND in the "result" data.frame; if not, that row is identified as NOT FOUND.
I present a short reprex to expose my issue:
segment<- data.frame(stringsAsFactors=FALSE,
ID1_seg = c("AAAA_AAAB", "AAAB_AAAC", "AAAG_AAAH"),
ID2_seg = c("AAAC_AAAD", "AAAD_AAAF", "AAAE_AAAF")
)
conflict<- data.frame(stringsAsFactors=FALSE,
ID1_conf = c("AAAA_AAAB", "AAAB_AAAC", "BBBG_BBBH"),
ID2_conf = c("AAAC_AAAD", "BBBD_BBBF", "BBBE_BBBF")
)
result<- data.frame(stringsAsFactors=FALSE,
ID1_conf = c("AAAA_AAAB", "AAAB_AAAC", "BBBG_BBBH"),
ID2_conf = c("AAAC_AAAD", "BBBD_BBBF", "BBBE_BBBF"),
Result = c("FOUND", "NOT FOUND", "NOT FOUND")
)
As it can be seen, only 1st row was found as ID2_conf in 2nd row wasn´t in "segment" data.frame and neither ID1_conf nor ID2_conf were found in "segment" data.frame.
Thanks in advance!