I'm building a small package for local distribution among our analysts that encapsulates the connection code for our Oracle databases. I would like to make it so that attaching that package also makes available all of the functions from the package DBI.
In other words, I would like it so that instead of this
library(mypackage)
library(DBI)
one could do this and have exactly the same effect
library(mypackage)
I tried looking at what happens when you do library(tidyverse) and it attaches ggplot2, tibble, etc., and I see there is a do.call applying library to those packages, but if I just include library(DBI) in my package that doesn't do the trick. This seems like it should be something simple, but I don't know how to search for it.
While re-exporting is "correct" in the sense that it will work I believe the easiest approach is including DBI in the Depends field of your DESCRIPTION file.
And as for the books I really recommend Hadley's R Packages. It was this book that got me started on the slippery slope of package development, all the way to CRAN submission.