Skip to Content
Modern R Programming Cookbook
book

Modern R Programming Cookbook

by Jaynal Abedin
October 2017
Beginner to intermediate
236 pages
7h 38m
English
Packt Publishing
Content preview from Modern R Programming Cookbook

How it works...

Every database software has its own driver that helps it to connect with the database.

Let's take a look at the following steps and see how they work:

  1. The first step to connect with the PostgreSQL database server is to call the driver and then connect with it. The following line of R code is used to activate the PostgreSQL database driver into R session:
        databaseDriver <- dbDriver("PostgreSQL")
  1. Once the driver is activated, the next task is to create a connection string with the database server and R session with the following code:
        con2DB <- dbConnect(databaseDriver, dbname = "postgres",  host           = "localhost", port = 5432, user = "postgres", password =         p_word)
  1. The dbConnect() function takes the driver object as the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

R Cookbook, 2nd Edition

R Cookbook, 2nd Edition

JD Long, Paul Teetor

Publisher Resources

ISBN: 9781787129054Supplemental Content