I'm creating a matrix of 1s and 0s. It is 1 if a word is part of a string, 0 otherwise.
For example the expected matrix would be something as follow:
white hanging heart holder black suitcase
white hanging heart holder 1 1 1 1 0 0
black suitcase 0 0 0 0 1 1
What I have at disposal are the 2 vectors:
Itemsvector = c("white hanging heart holder","black suitcase", ...)
Wordsvector = c("white","hanging","heart","holder","black", "suitcase",...)
I'm toying around the use of %in% operator
strsplit(Itemsvector[1], split = ' ')[[1]] %in% Wordsvector
Also
grepl(Wordsvector[1], Itemsvector)
Which does give me the TRUE and FALSE value, though I'm at lost to map this set of values to the whole matrix grid.