title: Can I attach one SQLite database to another with the DBI library in R?
body: <p>I am trying to attach one SQLite database to another. On the terminal, I can do this pretty simply with the <code>ATTACH</code> command, but I am working in an R script and I want to get it to work through a DBI connection. I have been able to attach with system calls, but it would be really nice to do it through a database connection.</p>
  <p>DBI Connection try:</p>
  <pre><code>library(DBI)
  
  NewDBFile &lt;- &quot;new.db&quot;
  archiveFile &lt;- &quot;archive.db&quot;
  
  con &lt;- dbConnect(RSQLite::SQLite(), NewDBFile)
  
  rs &lt;- dbExecute(conn = con, paste0(&quot;ATTACH &quot;, archiveFile, &quot; AS archive;&quot;))
  
  dbDisconnect(con)
  
  </code></pre>
  <p>With this I get an &quot;Error: no such column: [database name]&quot;</p>
  <p>Any ideas on how I would go about doing this?</p>