title: How do you explicitly delete a SQLite database created with the sqldf library in an R script
body: <p>I have created an R function to perform subsetting, summaries, densities, and plotting.  I was initially assigning out the subsets to my workspace in RStudio but I started running into memory constraints.  The latest revision is attempting to store the summarized observation counts in a SQLite database vs. exporting the subsets as their own dataframes.  The theory was that this would utilize less memory.  In order to perform this process I created a new database in my function as in:</p>
  
  <pre><code>sqldf("attach 'mydb' as new")
  sqldf("create table TotalsTbl as select 'resimrr' as name, count(*) as count from resimrr", dbname="mydb")
  sqldf("insert into TotalsTbl select 'resimrrquan' as name, count(*) as count from resimrrquan", dbname="mydb")
  </code></pre>
  
  <p>I then create a few tables, and populate them as the function processes.  Finally I export the query results of SQLite Tables to dataframes that I then assign out to my workspace.</p>
  
  <p>This provides the expected result:</p>
  
  <pre><code>sqldf("select * from TotalsTbl, dbname="mydb")
  name count
  1 resimrr 95517
  2 resimrrquan 93928
  </code></pre>
  
  <p>The challenge now is that the database is persistent.  It is created the first time the function is envoked, it lives in my Rsessions and my workspace and if I run the function again the CREATE TABLE commands fail because the tables already exist.  So the question is how do I delete/clean up 'mydb' after I am through with it in my function?</p>