Connect to registration database to get all necessary information
on data source and cleaning specification. The driver is only applicable
to an Access Database. Calling the method KHelse$new(YourFilePath)
will create an object of R6 Class. Please refer to the
examples.
Public fields
dbname
Database filename.
dbtype
Database type of either Access or DuckDB
dbyear
Production year. Only relevant for DuckDB
dbconn
Database connection.
tblname
Table name to be created in the database.
tblvalue
Data to be inserted in the table
tblname
. Data must be in adata.frame
ordata.table
format.dbpath
Database path
conn
Create database connection. Default is
TRUE
Methods
Method new()
Start connecting to the database.
Usage
KHelse$new(
dbname = NULL,
dbtype = "Access",
dbyear = NULL,
dbpath = FALSE,
conn = TRUE
)
Method db_write()
Write table to the database.
Usage
KHelse$db_write(
name = NULL,
value = NULL,
write = FALSE,
append = FALSE,
field.types = NULL
)
Arguments
name
Table name to be created in the database.
value
The data to be inserted in the table.
write
Write a table to the database. It will overwrite the table if it already exists
append
Append the data to an existing table in the database
field.types
Type of data in specified column. Must be named as vector
Examples
## ------------------------------------------------
## Method `KHelse$new`
## ------------------------------------------------
if (FALSE) { # \dontrun{
kh <- KHelse$new(file.path(getOption("orgdata.drive"),
getOption("orgdata.folder.db"),
getOption("orgdata.db")))
kh$dbname
kh$db_close()
kh$db_connect()
} # }