I have a dataframe with codes (as number) and characters. If the combinations exist the return value is 1 otherwise the return value is 0.
code A B C D
1 0 1 1 0
2 1 0 0 0
3 0 0 0 1
4 1 1 1 1
I want to create the output where for every code the characters are shown which are 1 (condition is that the match between code and charcter is 1).
output in a list or dataframe
1: B C
2: A
3: D
4: A B C D