title: Using INSERT statement in sqldf within R
body: <p>I am trying to use <strong>sqldf</strong> to <strong>insert</strong> rows into an existing (but empty) dataframe and I am getting a strange error. </p>
  
  <p>Here is my code: </p>
  
  <pre><code>set.seed(1)
  
  library(sqldf)
  
  # define empty dataframe
  d1 = data.frame(min_x=numeric(), max_x=numeric())
  
  # create a data frame of random numbers
  d2 = data.frame(x=runif(10))
  
  # This works fine
  sqldf("select min(x), max(x) from d2")
  
  # But, the following statement generates an error 
  sqldf("insert into d1 select min(x), max(x) from d2")
  </code></pre>
  
  <p>Here is the output: </p>
  
  <p>Not sure how to fix this. I am running R 3.1.0 on a 64-bit machine using Windows 7. </p>
  
  <pre><code>&gt;     set.seed(1)
  &gt;     
  &gt;     library(sqldf)
  &gt;     
  &gt;     # define empty dataframe
  &gt;     d1 = data.frame(min_x=numeric(), max_x=numeric())
  &gt;     
  &gt;     # create a data frame of random numbers
  &gt;     d2 = data.frame(x=runif(10))
  &gt;     
  &gt;     # This works fine
  &gt;     sqldf("select min(x), max(x) from d2")
        min(x)    max(x)
  1 0.06178627 0.9446753
  &gt;     
  &gt;     # But, the following statement generates an error 
  &gt;     sqldf("insert into d1 select min(x), max(x) from d2")
  Error in sqliteExecStatement(con, statement, bind.data) : 
    RS-DBI driver: (error in statement: no such table: d1)
  In addition: Warning message:
  In value[[3L]](cond) : bind.data must have non-zero dimensions
  &gt; 
  </code></pre>
  
  <p>What am I doing wrong? Thanks in advance. </p>