I'm new to programming and R.
I have a data like this in columns:
C1 C2 C3 C4 C5
Apple Apple Banana Banana
Banana Orange Orange
Orange
I want to make a binary matrix comparing all the columns to C1 where 1 is TRUE and 0 is FALSE. I want something like this:
C1 C2 C3 C4 C5
Apple 0 1 0 0
Banana 0 0 1 1
Orange 0 1 1 0
Does anyone know how to do this? Thank you.