Integrate with R-studio
One reason for choosing DuckDB as a pivot format is that it features a suite of clients that let you connect to the database and conduct your analyses in multiple programming languages, including Python, Node.js, R, and Java.
DuckDB's R Client
Python set up
To work with Heurist data in R, first generate the DuckDB database file using the Python command-line tool.
Install the CLI
- Install the
heurist
Python package.
Extract, transform, load
- Execute the
download
command.
heurist -d YOUR_DATABASE -l "your.login" -p "your-password" download -f heurist.duckdb
R set up
Then, follow DuckDB's instructions for connecting to the DuckBD database file in R.
Install the R Client
- Install the DuckDB R Client.
install.packages("duckdb")
Connect to the DuckDB database
Using the file path given in the heurist download
command, i.e. heurist.duckdb
, connect to the database file.
# Load the duckdb package
library("duckdb")
# Connect to the database file
con <- dbConnect(duckdb(), dbdir = "heurist.duckdb", read_only = FALSE)
Execute SQL queries in R
Execute SQL queries.
res <- dbGetQuery(con, "SELECT * FROM MyHeuristRecord")