title: Calculating variable values using paste function in R
body: <p>First let me say that I am not an expert coder and any advice about this particular question or my general technique will be greatly appreciated. </p>
  
  <p>I have a large data set that is made up of similar data frames named Table6.# such as: Table6.1, Table6.2, ect.  I have variables in each data frame that repeat as well, such as: ST1_Delta_PV%, ST2_Delta_PV%, ect. and ST1_Realloc_Margin, ST2_Reallocation_Margin, ect.  </p>
  
  <p>I am trying to write several nested loops that will calculated values in each table across these similar variables.  I have tried to do this with the paste function as shown below, but this is obviously not the correct way to do this.  </p>
  
  <pre><code>for (i in 1:25){
   for (j in 1:4){
    for (k in 1:length(paste("Table6.",i,"sep="")[,1]){
    paste("Table6.",i,sep="")$paste("ST",j,"NonTgt_Shr",sep="")[k] &lt;- paste("Table6.",i,sep="")$paste("ST",j,"_Delta_PV%",sep="")[k] * paste("Table6.",i,sep="")$paste("ST",j,"_Reallocation_Margin",sep="")[k]
    }
   }
  }
  </code></pre>
  
  <p>I apologize if this is a complete mess.  I appreciate your help.</p>