knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
The dwDBI
package provides:
First import the package.
library('dwDBI')
Make sure that you've configured your data.world API key.
dwapi::configure('YOUR API KEY HERE')
dwapi::configure(Sys.getenv('DATA_DOT_WORLD_API_KEY'))
To run a SQL query, connect to a data.world dataset with the dw_connect()
function.
sql101_conn <- dw_connect('ryantuck/sql-101-training')
In RStudio, you can write and run SQL code chunks by specifying a connection.
# ```{sql, connection=sql101_conn} # ... your query here ... #```
Running the SQL code chunk returns a data frame.
{sql, connection=sql101_conn}
select *
from customers
order by `last`
Again, you'll need to configure your API key.
To open a dataset in the Connections viewer:
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.