title: How to use list elements to query data from a database using dplyr?
body: <p>I use <code>dplyr</code> (version 0.8.3) to query data. The query includes parameters that are defined in the beginning of the query, as shown in the first reprex below. On top of that, I want to collect the parameters in a list, as shown the second reprex. The first and second examples, which query data from a dataframe, work fine. However, when I want to query data from a database using parameters saved in a list, the SQL translation produces a non-working SQL that cannot be used to query data from a database.</p>
  <p>Is there a way to incorporate list entries into a <code>dplyr</code> pipeline to query data from a database?</p>
  <pre><code>library(dplyr)
  library(dbplyr)
  library(RSQLite)
  
  # 1. Data frame: value 
  a &lt;- 1
  mtcars %&gt;% filter(vs == a) # Works
  
  # 2. Data frame: list value
  input &lt;- list()
  input$a &lt;- 1
  mtcars %&gt;% filter(vs == input$a) # Works
  
  # 3. Database: value and list value
  con &lt;- DBI::dbConnect(RSQLite::SQLite(), path = &quot;:memory:&quot;)
  copy_to(con, mtcars, &quot;mtcars&quot;, temporary = FALSE)
  db_mtcars &lt;- tbl(con, &quot;mtcars&quot;)
  
  db_mtcars %&gt;% filter(vs == a)          %&gt;% show_query() %&gt;% collect() # Works
  db_mtcars %&gt;% filter(vs == input$a)    %&gt;% show_query() %&gt;% collect() # Does not work
  db_mtcars %&gt;% filter(vs == input[1])   %&gt;% show_query() %&gt;% collect() # Does not work
  db_mtcars %&gt;% filter(vs == input[[1]]) %&gt;% show_query() %&gt;% collect() # Does not work
  </code></pre>
  <p>The background of my question is that I want to process and analyze data in a <code>shiny</code> app. I find it easier to develop the code for processing data outside the app and then include the code in the app afterwards. However, this task becomes increasingly difficult with a growing number of inputs. For development, my idea was to define a list named &quot;input&quot; such that I can copy and paste the code into the app. However, I stumble over the problem decribed above. Suggestions for an alternative development workflow are very welcome, too.</p>