title: Error while using reshape function in R
body: <p>I have a dataframe as follows,</p>
  
  <pre><code>  id  sex age trt.1 response.1 trt.2 response.2
  1  1 &lt;NA&gt;  NA     A          1     B          1
  2  2 &lt;NA&gt;  NA     A          1     B          1
  3  3 &lt;NA&gt;  NA     A          1     B          1
  4  4    M  28     A          1     B          1
  5  5    F  39     A          1     B          1
  6  6    M  47     A          1     B          1
  </code></pre>
  
  <p>I want to change it to</p>
  
  <pre><code>  id  sex age times response
  1  1 &lt;NA&gt;  NA  A      1
  2  1 &lt;NA&gt;  NA  B      1
  3  2 &lt;NA&gt;  NA  A      1
  4  2 &lt;NA&gt;  NA  B      1
  .
  .
  .
  .
  </code></pre>
  
  <p>I tried the following,</p>
  
  <pre><code>reshape(merged, idvar = "id", varying = list(4:7), v.names="response", times=c("A","B"), direction="long")
  </code></pre>
  
  <p>But I am getting this error,</p>
  
  <pre><code>Error in reshapeLong(data, idvar = idvar, timevar = timevar, varying = varying,  : 
    'times' is wrong length
  </code></pre>
  
  <p>I tried times = C("A","B","A","B") that time I get the output, but the original data frame is 70 rows and the output should be 140 rows, but when I use this I am get 280 rows which is wrong. Can anybody help me where I am doing mistake?</p>