# elConnect
#'
#' A helper function to connect to the database using .dbconf
#'
#' @param config Will use this config in the ~/.dbconf file. Default 'client'
#'
#' @return A connection object as returned from RMySQL
#' @export
#' @examples
#' con = dbConnect()
#'
#' @seealso \code{link[RMySQL]}
elConnect <- function(config = 'client')
{
dbconfig <- ini::read.ini("~/.dbconf")[[config]]
dbconfig$port = if (is.null(dbconfig$port)) 3306 else as.integer(dbconfig$port)
con <- with(dbconfig,
RMySQL::dbConnect(RMySQL::MySQL(), host = host, user = user, password = passwd, db = "met", port = port))
con
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.