♣15♣Connecting R to an SQL Database

In this section we will study one example of one RDBMS:MySQL. There are good reasons for this choice, it is widely used as a back-end of many websites, it is fast, reliable, and free. However, there are many databases available. In general, a good starting point is the package RODBC.

In many cases, one will find specific drivers (or rather APIs) for the DBMS that is being used. These interfaces come in the familiar form of packages. For MySQL or MariaDB, this is RMySQL.

With the package RMySQL, it is possible to both connect to MariaDB and MySQL in a convenient way and copy the data to R for further analysis. The basics of the package are to create a connection ...

Get The Big R-Book now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.