title: Reshape large dataset with multiple columns from wide to long
body: <p>I have a very large dataset that I need to reshape from wide to long. </p>
  
  <p>My datset looks something like:</p>
  
  <pre><code>  COMPANY   PRODUCT REVENUESJAN2010 REVENUESFEB2010 REVENUESMARCH2010 ... REVENUESDEC2016 COSTSJAN2010 COSTSFEB2010 COSTSMARCH2010 ... COSTSDEC2016
  COMPANY A PRODUCT 1            6400           11050              6550               10600         8500        10400           9100             9850
  COMPANY A PRODUCT 2            2700            3000              2800                3800         2850         2400           3100             3250
  COMPANY B PRODUCT 3            5900            4150              5750                3750         4200         6100           2950             4600
  COMPANY B PRODUCT 4             550             600                 0                 650          200          700            100              500
  COMPANY B PRODUCT 5            1500            3750               550                2100         1850         1700           3150              450
  COMPANY C PRODUCT 6           19300           17250             23600               21250        18200        26950          18200            23900
  </code></pre>
  
  <p>And I want them to look like:</p>
  
  <pre><code>  COMPANY    PRODUCT    DATE  REVENUES  COSTS
  COMPANY A  PRODUCT 1  Dec-16     10600   9850
  COMPANY A  PRODUCT 1  Feb-10     11050  10400
  COMPANY A  PRODUCT 1  Jan-10      6400   8500
  COMPANY A  PRODUCT 1  Mar-10      6550   9100
  COMPANY A  PRODUCT 2  Dec-16      3800   3250
  COMPANY A  PRODUCT 2  Feb-10      3000   2400
  COMPANY A  PRODUCT 2  Jan-10      2700   2850
  COMPANY A  PRODUCT 2  Mar-10      2800   3100
  COMPANY B  PRODUCT 3  Dec-16      3750   4600
  COMPANY B  PRODUCT 3  Feb-10      4150   6100
  COMPANY B  PRODUCT 3  Jan-10      5900   4200
  COMPANY B  PRODUCT 3  Mar-10      5750   2950
  COMPANY B  PRODUCT 4  Dec-16       650    500
  COMPANY B  PRODUCT 4  Feb-10       600    700
  COMPANY B  PRODUCT 4  Jan-10       550    200
  COMPANY B  PRODUCT 4  Mar-10         0    100
  COMPANY B  PRODUCT 5  Dec-16      2100    450
  COMPANY B  PRODUCT 5  Feb-10      3750   1700
  COMPANY B  PRODUCT 5  Jan-10      1500   1850
  COMPANY B  PRODUCT 5  Mar-10       550   3150
  COMPANY C  PRODUCT 6  Dec-16     21250  23900
  COMPANY C  PRODUCT 6  Feb-10     17250  26950
  COMPANY C  PRODUCT 6  Jan-10     19300  18200
  COMPANY C  PRODUCT 6  Mar-10     23600  18200
  </code></pre>
  
  <p>In Stata I would type <code>reshape long REVENUES COSTS, i(COMPANY PRODUCT) j(DATE) string</code></p>
  
  <p>How do I do this in R?</p>