title: For loop only calculates first line
body: <p>I am trying to construct a for loop that solves for a list of variables in a data set.
  However, once I run it, the code only seems to calculate the first variable. </p>
  
  <pre><code>for (t in 1:nTest){
  m = DataTest$Item[t]
  u = DataTest$User[t]
  Sorted = sort(ItemSim[,m], decreasing = T,index.return=TRUE)
  MostSim = Sorted$ix[1:N]
  Wgts = ItemSim[MostSim,m]
  DataTest$CosineItem = (t(Wgts) %*% UM.Item[MostSim,u])/sum(Wgts)
  DataTest$CosineItem}
  DataTest$CosineItem
  </code></pre>
  
  <p>Any help with this issue is greatly appreciated.</p>