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().

Read more

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).

Read more

RStudio Connections

RStudio connections can be extended through: Snippet Files that provide support for new connections using R templates that enable users and system administrators to list and create new connections. Packages that do one or more of the following: Implement the Connections Contract to manage and explore data in RStudio’s Connections Pane and/or Supply Snippet Files or a Shiny Application to extend RStudio’s New Connection dialog. Snippet Files A Connection Snippet File is an R code snippet with additional metadata which is intended to initialize a connection.

Read more

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 using library(dbplyr) andlibrary(dplyr). 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().

Read more

Back to top