R/pt_tables.R

Defines functions pt_tables

Documented in pt_tables

#' List the tables in the PubTator sqlite database
#'
#' @param db_con A connection to the PubTator sqlite database, as created via
#'   pubator_connector.
#'
#' @return A character vector of the names of the tables found in the database.
#' @export
#'
#' @examples
#' \donttest{
#' db_con <- pt_connector(pt_path)
#' pt_tables(db_con)
#' }
pt_tables <- function(db_con){
  tryCatch(
    {
      out <- DBI::dbListTables(db_con)
    },
    error = function(e){
      message(paste0("Error:\n", e, "\n"))
      stop("Failed to connect to database and call DBI::dbListTables")
    }
  )
  return(out)
}

Try the pubtatordb package in your browser

Any scripts or data that you put into this service are public.

pubtatordb documentation built on Dec. 1, 2019, 1:17 a.m.