title: R - How to find the first cell that is not empty in a column starting from a specific row
body: <p>I have inputs and related outputs that happen on later moments. Sometimes 1 input might result in several outputs. I would like to have the input and the first output related to this input in the same row (on the time moment of the input). Therefore I will have to find the first cell that is not empty starting from the row of the input time.</p>
  
  <p>This is my dataset:</p>
  
  <pre><code>time    event   result_of event
  11:15   input1  
  11:16       
  11:17       
  11:18       output1
  11:19       
  11:20       output2
  11:21   input2  
  11:22       output3
  11:23       
  11:24   input3  
  11:25       
  11:26       output4
  11:27   input4  
  11:28       
  11:29       output5
  </code></pre>
  
  <p>And this is my desired outcome:</p>
  
  <pre><code>time    event   result_of event
  11:15   input1  output1
  11:16       
  11:17       
  11:18       
  11:19       
  11:20       
  11:21   input2  output3
  11:22       
  11:23       
  11:24   input3  output4
  11:25       
  11:26       
  11:27   input4  output5
  11:28       
  11:29       
  </code></pre>
  
  <p>The code should be flexible in a sense that there might be a lot of rows between input and output, so it should always check for non-empty cells starting from the current row and going till the last row.</p>
  
  <p>Thank you on beforehand!</p>