I need to filter a data frame by column using another dataframe but because the matches could not be exact I guess using grepl would be a way.
the following code might exemplify:
A <- data.frame(X=c("RRT","FGT","UTX","GRW"),Y=c(5,6,9,4))
B <- data.frame(Z=c("PPL","FG","RT","UTX"))
A %>% filter(.,grepl("RT",X))
# the result using a single match
X Y
RRT 5
##desired result
A %>% filter(.,grepl(B,A$X))
A.X A.Y
RRT 5
FGT 6
UTX 9
What is the best way to accomplish that?