lets say i have the following dataframe:: this is one column of a bigger dataset I have but that is not relevent at the time.
first_column
1 hallo, test, twee, dire
2 hi, vier, twee, vijf
3 biep, boep, yes, twee
what I want to do is find matching values in the column:: so this example would give an output of::
twee
But I do not have an answer to how to approach this, first I thought match()
would do the trick but that is not working.
CodePudding user response:
You can use Reduce
with intersect
:
Reduce(intersect, strsplit(df$first_column, ", "))
#[1] twee