title: Debug Tools in R - stepping through code
body: <p>This input series works perfectly</p>
  
  <pre><code> Bond.Valuation (bond.id = bondlab10, principal = 1000, price = 100, 
   settlement.date =  "02-4-2013", trade.date = "1-31-2013")
  </code></pre>
  
  <p>This throws an error</p>
  
  <pre><code> Bond.Valuation (bond.id = bondlab10, principal = 1000, price = 100, 
   settlement.date =  "01-5-2013", trade.date = "12-31-2012")
  
   #Error in Key.Rate.Table[x, 3] = (spotrates("ns", BetaVector, m = Key.Rate.Table[x, 
      : replacement has length zero.
  </code></pre>
  
  <p>I am trying to use debug tools to step through the code but I am not having much luck. I get the following when I debug</p>
  
  <pre><code>debug at &lt;tmp&gt;#29: Bond.Term.Structure &lt;&lt;- Key.Rate.Analysis(bond.id = bondlab10, 
  Rate.Delta = Rate.Delta, BetaVector = BetaVector, principal = principal, 
  price = price, cashflow = Bond.CashFlow)
  </code></pre>
  
  <p>I know the function and the line but I have no idea what is wrong from the messages.  Advise on debugging is appreciated.  Basically, I have a long settlement here but this will be required for mortgage backed securities.</p>
  
  <p>-Update, I found the problem but not from the debugger.  Is there a way to watch R step through each calculation and see values? </p>