title: Merge multiple variables in R
body: <p>I have a dataset such that the same variable is contained in difference columns for each subject. I want to merge them to the same columns. </p>
  
  <p>E.g.:, I have this dataframe, and there are three DVs, but they are in different columns (A,B,C) for different subjects. </p>
  
  <pre><code>data.frame(ID = c(1,2,3), DV1_A=c(1,NA,NA), DV1_B= c(NA,4,NA), DV1_C = c(NA,NA,5), DV2_A=c(3,NA,NA), DV2_B=c(NA,3,NA), DV2_C=c(NA,NA,5), FACT = c("A","B","C"))
  </code></pre>
  
  <p>How can I merge them to just two columns? so the result is:</p>
  
  <pre><code>data.frame(ID = c(1,2,3), DV1_A=c(1,NA,NA), DV1_B= c(NA,4,NA), DV1_C = c(NA,NA,5), DV2_A=c(3,NA,NA), DV2_B=c(NA,3,NA), DV2_C=c(NA,NA,5), FACT = c("A","B","C"), DV_1 = c(1,4,5), DV_2 = c(3,3,5))
  </code></pre>