Learn R Programming

duckdb

Installation from CRAN

install.packages("duckdb")

Installation from r-universe

install.packages("duckdb", repos = c("https://duckdb.r-universe.dev", "https://cloud.r-project.org"))

Installation from GitHub

# install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/stable/%s/%s/%s", .Platform$pkgType, R.Version()$os, R.Version()$arch))
pak::pak("duckdb/duckdb-r")

User Guide

See the R API in the DuckDB documentation.

Building

To build the bleeding edge of duckdb-r, you can clone this repository and run

~duckdb-r: R CMD INSTALL .

If you wish to test new duckdb functionality with duckdb-r, make sure your clones of duckdb-r and duckdb share the same parent directory. Then run the following commands

~ (cd duckdb && git checkout {{desired_branch}})
~ (cd ducdkb-r && ./vendor.sh)
~ (cd duckdb-r && R CMD INSTALL .)

It helps if both the duckdb directory and duckdb-r directory are clean. If you encounter linker errors, merge both duckdb-r and duckdb with their respective main branches.

Dependencies

To build the R package, you first need to install the dependencies:

# install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/stable/%s/%s/%s", .Platform$pkgType, R.Version()$os, R.Version()$arch))
pak::pak()

Developing with Extensions

If you wish to build or add extensions to the R package you first need to build duckdb with the extension_static_build flag. The following commands allow you to add the httpfs extension to a DuckDB R build. See the extension ReadMe for more information about extensions

cd duckdb/
EXTENSION_STATIC_BUILD=1 make

Then in R, run:

library(duckdb)
con <- DBI::dbConnect(duckdb(config=list('allow_unsigned_extensions'='true')))
dbExecute(con, "LOAD '{{path_to_duckdb}}/build/release/extension/httpfs/httpfs.duckdb_extension'")

For more information about using extensions, see the documentation on extensions. For instructions on building them, see extension README.

Contributors

Thanks to all contributors to this repository, and to those who contributed when the code was still hosted in the main duckdb/duckdb repository:

Mark Raasveldt, Pedro Holanda, Tom Ebergen, Reijo Sund, Nicolas Bennett, Patrik Schratz, Tishj, Laurens Kuiper, Sam Ansmink, Andy Teucher, Hadley Wickham, Jonathan Keane, Lindsay Wray, Richard Wesley, Elliana May, Edwin de Jonge, Dewey Dunnington, Carlo Piovesan, Andre Beckedorf, Tania Bogatsch, Pedro Ferreira, Maximilian Girlich, James Lamb, James Atkins, usurai, Ubuntu, Noam Ross, Michael Antonov, Jeroen Ooms, Jamie Lentin, Jacob, and Chilarai.

Copy Link

Version

Install

install.packages('duckdb')

Monthly Downloads

20,522

Version

0.10.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Hannes Muehleisen

Last Published

March 13th, 2024

Functions in duckdb (0.10.0)

duckdb_prepare_substrait

Query DuckDB using Substrait Method for interpreting a Substrait BLOB plan as a DuckDB Query Plan It interprets and executes the query.
duckdb_driver-class

DuckDB driver class
duckdb_get_substrait

Get the Substrait plan for a SQL query Transforms a SQL query into a raw vector containing the serialized Substrait query blob
duckdb

Connect to a DuckDB database instance
duckdb_get_substrait_json

Get the Substrait plan for a SQL query in the JSON format Transforms a SQL query into a vector containing the serialized Substrait query JSON
backend-duckdb

DuckDB SQL backend for dbplyr
duckdb_explain-class

DuckDB EXPLAIN query tree
duckdb_read_csv

Reads a CSV file into DuckDB
duckdb_prepare_substrait_json

Query DuckDB using Substrait Method for interpreting a Substrait JSON plan as a DuckDB Query Plan It interprets and executes the query.
duckdb_register_arrow

Register an Arrow data source as a virtual table
duckdb_register

Register a data frame as a virtual table
duckdb_connection-class

DuckDB connection class
duckdb-package

duckdb: DBI Package for the DuckDB Database Management System
read_csv_duckdb

Deprecated functions
duckdb_result-class

DuckDB Result Set