title: Subsetting dataset into new variables based on event dates
body: <p>I am looking into German bond yield development around certain event dates indicated by <code>APP=1</code> in the dataset below. For example, on both 4 Sep 2014 and 12 Sep 2014 an event occurs. </p>
  
  <p>I want to compare how the market reacts three days prior and after the event. In short, I want my figure below to contain one more line, representing the time around the second event. </p>
  
  <p><img src="https://i.stack.imgur.com/PpZbi.png" alt=""></p>
  
  <p>In order to make such a figure I need to manipulate my data. Here is my current dataset: </p>
  
  <pre><code>df &lt;- Date   APP  DE10 
    2014-09-22 0    1.010 
    2014-09-19 0    1.043
    2014-09-18 0    1.081
    2014-09-17 0    1.050
    2014-09-16 0    1.061
    2014-09-15 0    1.067
    2014-09-12 1    1.082
    2014-09-11 0    1.041
    2014-09-10 0    1.047
    2014-09-09 0    0.996
    2014-09-08 0    0.953
    2014-09-05 0    0.928
    2014-09-04 1    0.970
    2014-09-03 0    0.955
    2014-09-02 0    0.931
    2014-09-01 0    0.882
  </code></pre>
  
  <p>I want my dataset to look like this: </p>
  
  <pre><code> APP      Indicator  DE10_Event1 DE10_Event2
   0        1          1.050      0.996
   0        2          1.061      0.996
   0        3          1.067      0.996
   1        4          1.082      0.970
   0        5          1.041      0.955
   0        6          1.047      0.931
   0        7          0.996      0.882
  </code></pre>
  
  <p>This way, I will have the option of plotting the lines in the same figure, as they now have the same y-axis and x-axis.</p>
  
  <p>Thanks in advance for your help!</p>