I am keeping my database connections in a separate file which I usually source at the beggining of the script (eg. source("~/R/dbConnections.R"). Would it be possible to source separate code chunks if I converted the document to RMarkdown - in order to not get my environment populated with a bunch of connections. I prefer to keep all the connections in a single file, so separate file for each connection is nogo.
Instead of source("~/R/dbConnections.R") you would call knitr::read_chunk("~/R/dbConnections.R") and then call your connections like this (if you called your chunks con-a, con-b...):