Читать книгу The Big R-Book - Philippe J. S. De Brouwer - Страница 179
Connecting to the Database
ОглавлениеThis is explained in more detail in Chapter 15 “Connecting R to an SQL Database” on page 327, but the code segment below will already get you the essential ingredients.
# The connection is stored in an R object myConnection and # it needs the database name (db_name), username and password myConnection = dbConnect(MySQL(), user = ‘root’, password = ‘xxx’, dbname = ‘db_name’, host = ‘localhost’) # e.g. list the tables available in this database. dbListTables(myConnection)
dbConnect()
dbSendQuery()