DBCon | R Documentation |
R6 class for for connecting to your OFPE database. The default database driver is PostgreSQL as that is recommended for OFPE use and shown in the OFPE tutorials and vignettes. However, any database driver can be supplied. This class was created to consolidate database connections being supplied to functions and other R6 classes in the OFPE data workflow.
Users can connect with any DBI compliant option. Using RPostgreSQL drivers on a Mac, users can provide the user, password, dbname, host, and port. If on a Windows computer the user just needs to set up a PostgreSQL ODBC driver, and supply the DSN, user, and password.
db
Database connection, such as PostgreSQL connection.
new()
Create a database connection inside of the DBCon class.
DBCon$new( user = NA, password = NA, dbname = NULL, host = NULL, port = NULL, dsn = NULL )
user
Username associated with the database owner.
password
Password associated with the database owner.
dbname
Name of the database to connect to.
host
Host name of the database location (typically localhost) unless user is connecting to a non-local database.
port
The port number of the database.
dsn
Optional. If ODBC database source name is setup. Required for Windows users.
An open database connection.
disconnect()
Close a database connection in the DCCon class.
DBCon$disconnect()
None
No parameters necessary. Simply call the method.
A closed database connection.
clone()
The objects of this class are cloneable with this method.
DBCon$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.