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 to do it...

The steps for this recipe are as as follows:

  1. Load the RSQLite library.
  2. Create an object by calling up the SQLite database driver.
  3. Create a connection string with the database engine and R session. The database will be created in this same step.
  4. Create a data table and insert actual data from the mtcars dataset.
  5. Extract only those rows containing automatic transmission cars with the variable "am" ==0.
  6. Display the first few rows of the extracted dataset.
  7. Disconnect the database driver.
  8. Disconnect the database.

The code to perform the preceding tasks is as follows:

        library(RSQLite)        dbDriverSQLite <- dbDriver("SQLite")        dbNew <- dbConnect(drv = dbDriverSQLite, dbname="testdbSQL") carTable <- dbWriteTable(con = dbNew, name = ...
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