Here's the same task we solved in Python. I've tried utilizing a similar approach of creating an empty dictionary from pre-split (R's strsplit) keys and unpacking all corresponding post-split strings as values. Then, next step is to create all combinations but no more than one pre-split string can exist in the resulting combinations.
Here is my input list:
list('ROOM1-abc',
'ROOM1-def',
'ROOM2-abc',
'ROOM2-lol',
'ROOM3-whatever')
And the desired output (with 2-length combinations (needs to be able to pick the length of combination elements returned)):
['ROOM1-abc', 'ROOM2-lol'],
['ROOM1-abc', 'ROOM3-whatever'],
['ROOM1-def', 'ROOM2-abc'],
['ROOM1-def', 'ROOM2-lol'],
['ROOM1-def', 'ROOM3-whatever'],
['ROOM2-abc', 'ROOM3-whatever'],
['ROOM2-lol', 'ROOM3-whatever']]
I'm struggling with the sub-item list indexing syntax in Python vs. R as well as having to learn R for a specific need on a problem we've solved already via Python .