title: R error when calculating log rates of returns on portfolios (ETFs)
body: <p>I have tried to calculate the log rate of return for a world index (labled acw) portfolio and a country index portfolio (labled chi). The world index works but the country index gives me the error "only 0's may be mixed with negative subscripts". I have combed the data and there are no zeros or negative numbers in it. I'm going insane trying to work it out. I am learning R for the first time so it is probably a very basic problem but I can't find an answer anywhere online. Here is the code,</p>
  
  <pre><code>&gt; data &lt;- read.table("C:/Documents and Settings/Emma/My Documents/data.csv",header=T,sep=",")
  &gt; data &lt;- data.frame(data)
  
  &gt; td&lt;-length(data$date)
  &gt; t&lt;-td-1
  
  &gt; acwr&lt;-250*log(data$acw[2:td]/data$acw[1:(td-1)])
  &gt; chir&lt;-250*log(data$chi[2:td]/data$chi[1:(td-1)])
  Error in data$chi[1:(td - 1)] : 
    only 0's may be mixed with negative subscripts
  &gt; traceback()
  No traceback available 
  </code></pre>
  
  <p>Any advice or help would be much appreciated!</p>