title: Variable that updates conditional value
body: <p>I have a dataframe with two columns: Tick and Bid. This is tick data for a financial instrument. If the Tick column has a value price has moved up/down. The Bid column holds the current bid price. Here's an example:</p>
  
  <pre><code>Test &lt;- data.frame(Tick=c(NA, NA, NA ,NA, NA , "1", NA, NA, NA,
                            NA, NA, "-1",NA, NA),
                     Bid=c("393.75", "393.75" ,"393.75" ,"394", "394",
                            NA,"394" ,"394","394","394","393.75",
                            NA, "393.75", "393.75"))
  </code></pre>
  
  <p>I want to create a variable I'll call <code>Best_Bid_Ex</code> that holds the value of the first price after a tick event occurs (<code>is.na(Test$Tick == FALSE)</code>) and resets with the new bid price with the next event.</p>
  
  <pre><code>Test$Best_Bid_Ex &lt;- c("393.75", "393.75" ,"393.75" ,"393.75", 
  "393.75", NA,"394" ,"394","394","394","394", NA, "393.75", "393.75")
  </code></pre>
  
  <p>I tried different indexing techniques but I can't get anything to work.</p>