I have a data set like the subset below
col1 col2 col3
y
y
y y
y
y
y
In reality, my data set is describing drug overdoses. There is a "y" in the column for the drug that was in each persons system when they died. What I'm trying to do is change the "y" to the cooresponding column. for example, I want the example data set above to appear as
col1 col2 col3
col1
col2
col1 col2
col3
col2
col1
So that I can later combine these three columns to know what each person died of, but only looking in one column. Data set is called "Data1", so I know that I need at some point to put
Data1$col1
Data1$col2
Data1$col3
Someone please help.. I'm very new at this.