title: reshaping data from wide to long, but with some complexity
body: <p>I made minimal reproducible example, but my real data is huge and complicated
  This is the example</p>
  <pre><code>
  fact_1_p_model1 &lt;- c(1,3,4,2,5)
  ra_2_p_model1&lt;- c(5,6,4,2,3)
  da_1_p_model2 &lt;- c(3,5,3,1,5)
  dd_2_p_model2 &lt;- c( 4,2,5,2,1)
  fact_1_p_nonlinearmodel1&lt;-c( 4,2,5,2,2)
  tt_2_p_nonlinearmodel1&lt;-c( 3,6,5,3,1)
  fact_1_p_nonlinearmodel2&lt;-c( 1,2,6,2,4)
  rara_2_p_nonlinearmodel2&lt;-c( 9,5,5,2,1)
  id&lt;-1:5
  data&lt;-data.frame(fact_1_p_model1, ra_2_p_model1, da_1_p_model2, dd_2_p_model2,
                   fact_1_p_nonlinearmodel1, tt_2_p_nonlinearmodel1, fact_1_p_nonlinearmodel2,
                   rara_2_p_nonlinearmodel2,id)
  
  </code></pre>
  <p>so, currently, I have a dataset like this</p>
  <pre><code> data
    fact_1_p_model1 ra_2_p_model1 da_1_p_model2 dd_2_p_model2 fact_1_p_nonlinearmodel1
  1               1             5             3             4                        4
  2               3             6             5             2                        2
  3               4             4             3             5                        5
  4               2             2             1             2                        2
  5               5             3             5             1                        2
    tt_2_p_nonlinearmodel1 fact_1_p_nonlinearmodel2 rara_2_p_nonlinearmodel2 id
  1                      3                        1                        9  1
  2                      6                        2                        5  2
  3                      5                        6                        5  3
  4                      3                        2                        2  4
  5                      1                        4                        1  5
  
  
  
  </code></pre>
  <p>and, I want to make this data to a long format with two guide columns (&quot;model&quot;, &quot;coef&quot;)</p>
  <pre><code>
  model &lt;- c(&quot;model1&quot;,&quot;model1&quot;,&quot;model2&quot;,&quot;model2&quot;,&quot;nonlinearmodel1&quot;,&quot;nonlinearmodel1&quot;,
             &quot;nonlinearmodel2&quot;,&quot;nonlinearmodel2&quot;)
  coef &lt;- c(&quot;fact_1_p_&quot;,&quot;ra_2_p_&quot;,&quot;da_1_p_&quot;,&quot;dd_2_p_&quot;,&quot;fact_1_p_&quot;,&quot;tt_2_p_&quot;,&quot;fact_1_p_&quot;,&quot;rara_2_p_&quot;)
  
  #value &lt;- ?? don't know how to... 
  #id &lt;- ??
  
  data_long&lt;-data.frame(model,coef
  #,value, id
  )
  
  </code></pre>
  <p>if I exclude value, and id, it is like this. but I want to put value and id as well, and I did it manually, but I cannot do it manually for my real data.</p>
  <pre><code>&gt; data_long
              model      coef
  1          model1 fact_1_p_
  2          model1   ra_2_p_
  3          model2   da_1_p_
  4          model2   dd_2_p_
  5 nonlinearmodel1 fact_1_p_
  6 nonlinearmodel1   tt_2_p_
  7 nonlinearmodel2 fact_1_p_
  8 nonlinearmodel2 rara_2_p_
  
  </code></pre>
  <p>with this small dataset, I can do it manually.
  but with my real huge data, I cannot.</p>
  <p>how can I do this?
  how can I reshape the wide data (that shown in the first) to long data as I show?</p>