title: R- how to dynamically name data frames?
body: <p>I have two types of files in my directory. Each type has either the text "Drug_Rep" in it or if its not there it means its a control file.
  Drug data has replicates which can vary in number and so does the control.
  I am reading the files in a for loop as follows.
  I want to name my dataframes as X_Drug_Rep1 and then the next as X_Drug_Rep2 and so on...and save the dataframe for further processing.
  Do the same for controls...X_CONTROL_Rep1...X_CONTROL_Rep2...and so on.
  What is the syntax to save my data into dataframes because i need to do some merges and calculations later on the drug replicate dataframes and controls separately. 
  paste on the left side of assignment does not seem to work. Any suggestions?</p>
  
  <pre><code>for (f in 1:length(fileList)){
      fileName &lt;- fileList[f]
      X &lt;-read.xls(fileName)
  
      if(regexpr("Drug_Rep", fileName)[1]&gt;0){
        print("DRUG")
        print(fileName)
        paste(X_Drug_Rep,i)&lt;-X
        i=i+1
      }
      else{
        print("CONTROL")
        print(fileName)
        paste(X_CONTROL,j)&lt;-X
        j=j+1
      }
    }
  </code></pre>