Connecting R to postgreSQL database
<p>I am trying to connect R to a postgreSQL database. He is what I have been trying in R:</p>

<pre><code>require("RPostgreSQL")

pw&lt;- {
  "password"
}

# loads the PostgreSQL driver
drv &lt;- dbDriver("PostgreSQL")
# creates a connection to the postgres database
# note that "con" will be used later in each connection to the database
con &lt;- dbConnect(drv, dbname = "DBname",
                 host = "localhost", port = 5432,
                 user = "user", password = pw)
rm(pw) # removes the password

# check for the test_table
dbExistsTable(con, "test_table")
# FALSE &gt;&gt;&gt; Should be true
</code></pre>

<p>I cannot figure out why it is not properly connecting to my database. I know that the database is on my computer as I can connect to it in the terminal and with pgAdmin4. Any help is greatly appreciated.</p>

<p>Thanks</p>