Reputation: 186
Suppose I have two data frames with strings in their elements:
B <- data.frame(c("abcd1","cdbax2","acdb3"))
colnames(B) <- "Strings"
A <- data.frame(c("abcd_11","cdba_12"))
colnames(A) <- "Strings"
yielding the pair of dataframes,
> A
Strings
1 abcd_11
2 cdba_12
and
> B
Strings
1 abcd1
2 cdbax2
3 acdb3
Desired output: B*, B purged of the partial strings that are not in A:
> B*
Strings
1 abcd1
2 cdbax2
Any ideas will be much appreciated.
Cheers
Edit: a solution based on string length does not work, since it is possible to have differing lengths in the dataframe
Upvotes: 0
Views: 37