title: RPostgreSQL - Passing Parameter in R to a Query in RPostgreSQL
body: <p><strong>Question</strong>: How do I pass a variable in the RPostgreSQL query?  </p>
  
  <p><strong>Example</strong>: In the example below I try to pass the date '2018-01-03' to the query</p>
  
  <pre><code>library(RPostgreSQL)
  
  dt &lt;- '2018-01-03'
  
  connect &lt;- dbConnect(PostgreSQL(), 
                   dbname="test",
                   host="localhost",
                   port=5432,
                   user="user", 
                   password="...")
  result &lt;- dbGetQuery(connect,
                  "SELECT * FROM sales_tbl WHERE date = @{dt}")
  </code></pre>