title: How to import data from PostgreSQL database to R?
body: <p>I'm thinking of importing data from database directly into r using <code>RPostgresQL</code> package. So far, I used to write queries in <code>Postico</code> (a PostgreSQL client) software and export as csv and then import the csv file into R.<br>
  This is what I've written so far and no clue how to proceed next.</p>
  
  <pre><code>library('RPostgreSQL')
  pg=dbDriver("PostgreSQL")
  con = dbConnect(pg, user="msahil515", password="",
              host="localhost", port=5432, dbname="msahil515")
  </code></pre>
  
  <p>How do I load tables from the database into R after this or how to write queries in R to extract only necessary data from database?</p>