title: Simple R task: divide specified columns by 1000 at specified rows
body: <p>I have an OHLC array of stock quotes that I want to process. </p>
  
  <pre><code>             Open      High      Low        Close         Volume
  2003-01-05   6111.01   6145.00   6102.70    6145.00         956
  2003-01-08   6145.00   6190.00   5960.00    6135.05        8771
  2003-01-09   6120.01   6250.00   6120.00    6225.00       10579
  2003-01-10   6240.00   6285.00   6225.10    6261.00        8882
  2003-01-13   6231.00   6325.00   6231.00    6270.00        8015
  2003-01-14   6279.00   6295.00   6180.01    6190.00        8461
  </code></pre>
  
  <p>The company made a split @ given date, so I need to divide all open,high,low,close columns before that date by 1000.
  As I am learning R basics now I want to figure out nice R solution for this task.
  The best piece of code I've managed to code is (cant find out how to apply to given cols, stock$Open doesn't work):</p>
  
  <pre><code>apply(stock, 2, function(stock) stock/((index(stock)&lt;"2007-07-20")*1000) )
  </code></pre>
  
  <p>However, the results are strange, many of them are inf:</p>
  
  <pre><code>2006-10-26       Inf       Inf       Inf        Inf         Inf
  2006-10-27       Inf       Inf       Inf        Inf         Inf
  2006-10-30       Inf       Inf       Inf        Inf         Inf
  2006-10-31       Inf       Inf       Inf        Inf         Inf
  2006-11-01       Inf       Inf       Inf        Inf         Inf
  2006-11-02       Inf       Inf       Inf        Inf         Inf
  2006-11-03       Inf       Inf       Inf        Inf         Inf
  2006-11-07       Inf       Inf       Inf        Inf         Inf
  </code></pre>
  
  <p>Many thanks in advance!</p>