Connections Contract The RStudio Connections Pane can display database-like connections from any R package which implements a connections contract. The Connections Pane acts like an observer; the R package notifies the observer when an event related to the connection occurs. In RStudio builds which support the Connections Pane, the connectionObserver option is populated with a list of three functions: connectionOpened(), connectionUpdated(), and connectionClosed(). Connection Opened When a new connection is opened, your R package should inform the Connections Pane by calling connectionOpened().
Implementing a new backend The goal of this document is to help you implement a new backend for DBI. If you are writing a package that connects a database to R, I highly recommend that you make it DBI-compatible because it makes your life easier by spelling out exactly what you need to do. The consistent interface provided by DBI makes it easier for you to implement the package (because you have fewer arbitrary choices to make), and easier for your users (because it follows a familiar pattern).
RStudio Snippets Overview Code snippets are text macros that are used for quickly inserting common snippets of code. For example, the fun snippet inserts an R function definition: Snippet Completion If you select the snippet from the completion list, it will be inserted along with several text placeholders which you can fill in by typing and then pressing Tab to advance to the next placeholder: Snippet Insertion Other useful snippets include:
SQL translation There are two components to dplyr’s SQL translation system: translation of vector expressions like x * y + 10 translation of whole verbs like mutate() or summarise() To explore them, you’ll need to load both dbplyr and dplyr: library(dbplyr) library(dplyr) Vectors Most filtering, mutating, or summarising operations only perform simple mathematical operations. These operations are very similar between R and SQL, so they’re easy to translate. To see what’s happening yourself, you can use translate_sql().