title: R use values in vector to become name of dataframe
body: <p>I am getting the names of tables from a database and I want to select all the data from each table and create a dataframe automatically. The code</p>
  
  <pre><code>nm = dbListTables(connection)
  </code></pre>
  
  <p>creates a vector like:</p>
  
  <pre><code>[1] "Account"                          "Credit__Amortization_Payment__c" 
  [3] "Credit__Amortization_Schedule__c" "Credit__Loan_Payment__c"         
  [5] "Credit__Loan__c"
  </code></pre>
  
  <p>As an example,</p>
  
  <pre><code> nm = c("Account", "Credit__Amortization_Payment__c", "Credit__Amortization_Schedule__c", "Credit__Loan_Payment__c", "Credit__Loan__c")
  </code></pre>
  
  <p>I create a list of a query for each value in a loop: </p>
  
  <pre><code>qry &lt;- list()
  for (i in 1:length(nm)) {
    qry[i] &lt;- paste0("select * from ", nm[i])
    }
  </code></pre>
  
  <p>Then I can't figure out how to save the name of the data frame as the values from the vector, so I have to manually type it out like this, but I would like to just loop through it saving a data frame with exactly the same name and structure from the list nm.</p>
  
  <pre><code>q = paste0(qry[1])
  rs &lt;- dbSendQuery(con, q)
  Account &lt;- dbFetch(rs, n=-1)
  </code></pre>
  
  <p>I repeat it here for each value in the vector manually but I would like to do this automatically based on the values in nm = dbListTables(connection)</p>
  
  <pre><code>q = paste0(qry[3])
  rs &lt;- dbSendQuery(con, q)
  Credit__Amortization_Schedule__c &lt;- dbFetch(rs, n=-1)
  </code></pre>