--- warning: DO NOT CHANGE THIS MANUALLY, THIS IS GENERATED BY https://github.com/duckdb/community-extensions repository, check README there title: dplyr excerpt: | DuckDB Community Extensions R dplyr pipeline syntax support for DuckDB - transpiles dplyr verbs to SQL # ============================================================================= # DuckDB Community Extension Descriptor for dplyr # ============================================================================= # This file should be submitted to duckdb/community-extensions repository # Path: extensions/dplyr/description.yml # ============================================================================= extension: name: dplyr description: R dplyr pipeline syntax support for DuckDB - transpiles dplyr verbs to SQL version: 0.7.0 language: Rust & C++ build: cmake license: MIT excluded_platforms: "windows_amd64_rtools" requires_toolchains: "rust" maintainers: - mrchypark repo: github: mrchypark/libdplyr ref: 53e70ca0e75d13f6684261c12b4ddd36a0608dd8 variegata: 836fc09dbecfac027ee35cb6d63024a4dfe10f0e docs: hello_world: | -- Transform R dplyr pipeline syntax directly in DuckDB -- First, create a sample table CREATE TABLE iris AS SELECT * FROM (VALUES (5.1, 3.5, 1.4, 0.2, 'setosa'), (4.9, 3.0, 1.4, 0.2, 'setosa'), (7.0, 3.2, 4.7, 1.4, 'versicolor'), (6.4, 3.2, 4.5, 1.5, 'versicolor'), (6.3, 3.3, 6.0, 2.5, 'virginica'), (5.8, 2.7, 5.1, 1.9, 'virginica') ) AS t(sepal_length, sepal_width, petal_length, petal_width, species); -- Run a pipeline directly as a statement (parser extension) iris %>% filter(sepal_length > 5) %>% select(species, sepal_length, petal_length) %>% arrange(desc(sepal_length)); ┌────────────┬──────────────┬──────────────┐ │ species │ sepal_length │ petal_length │ ├────────────┼──────────────┼──────────────┤ │ versicolor │ 7.0 │ 4.7 │ │ versicolor │ 6.4 │ 4.5 │ │ virginica │ 6.3 │ 6.0 │ │ virginica │ 5.8 │ 5.1 │ │ setosa │ 5.1 │ 1.4 │ └────────────┴──────────────┴──────────────┘ -- Group and summarize with dplyr syntax iris %>% group_by(species) %>% summarise(avg_sepal = mean(sepal_length), count = n()); ┌───────────┬───────┐ │ avg_sepal │ count │ │ double │ int64 │ ├───────────┼───────┤ │ 6.05 │ 2 │ │ 5.0 │ 2 │ │ 6.7 │ 2 │ └───────────┴───────┘ -- Create derived columns with mutate iris %>% mutate(sepal_ratio = sepal_length / sepal_width) %>% select(species, sepal_ratio) %>% arrange(sepal_ratio); -- Embed a pipeline inside normal SQL using (| ... |) SELECT species, COUNT(*) AS n FROM (| iris %>% filter(sepal_length > 5) %>% select(species) |) GROUP BY species ORDER BY n DESC; extended_description: | `dplyr` is a DuckDB extension that brings R's popular dplyr package syntax to DuckDB. It transpiles dplyr pipeline syntax (using the `%>%` pipe operator) directly to SQL, allowing R users to write familiar data manipulation code in DuckDB. **Supported dplyr Verbs:** - `select()` - Choose columns by name - `filter()` - Filter rows based on conditions - `mutate()` - Create new columns or modify existing ones - `arrange()` - Sort rows (supports `desc()` for descending order) - `group_by()` - Group data by one or more columns - `summarise()` / `summarize()` - Aggregate grouped data - `rename()` - Rename columns **Aggregation Functions:** - `n()` - Count rows - `mean()` / `avg()` - Average - `sum()` - Sum - `min()` / `max()` - Minimum / Maximum - `median()` / `mode()` - DuckDB-specific aggregates - Other aggregate function names are passed through to DuckDB (uppercased). **Key Features:** - Native R dplyr syntax support with `%>%` pipe operator - Transpiles to optimized SQL at runtime - Works with any DuckDB table (pipelines must start with a table name) - Error messages include helpful diagnostics - Embed pipelines in normal SQL using `(| ... |)` (e.g., `SELECT * FROM (| iris %>% filter(x > 0) |);`) **Usage:** ```sql -- Using the dplyr() table function SELECT * FROM dplyr('table_name %>% filter(x > 5) %>% select(a, b)'); -- Or write a pipeline directly as a statement (parser extension) table_name %>% filter(x > 5) %>% select(a, b); ``` For more information, visit the [GitHub repository](https://github.com/mrchypark/libdplyr). extension_star_count: 18 extension_star_count_pretty: 18 extension_download_count: 855 extension_download_count_pretty: 855 image: '/images/community_extensions/social_preview/preview_community_extension_dplyr.png' layout: community_extension_doc --- ### Compatibility Matrix This table covers all DuckDB releases that have not reached [end-of-life](https://duckdb.org/release_calendar), including LTS releases, and shows the 2 most recent patch releases of each. Older patch releases are not listed, but the extension may be available for them as well.
| Platform | 1.4.4 | 1.4.5 | 1.5.5 | 1.5.6 | 2.0.0 | | :--- | :---: | :---: | :---: | :---: | :---: | | Linux AMD64 | ❌ | ❌ | ✅ | ✅ | ✅ | | Linux ARM64 | ❌ | ❌ | ✅ | ✅ | ✅ | | macOS AMD64 | ❌ | ❌ | ✅ | ✅ | ✅ | | macOS ARM64 | ❌ | ❌ | ✅ | ✅ | ✅ | | Windows AMD64 | ❌ | ❌ | ✅ | ✅ | ✅ | | Windows ARM64 | ❌ | ❌ | ❌ | ❌ | ❌ | | WebAssembly | ❌ | ❌ | ✅ | ✅ | ✅ | ### Installing and Loading ```sql INSTALL {{ page.extension.name }} FROM community; LOAD {{ page.extension.name }}; ``` {% if page.docs.hello_world %} ### Example ```sql {{ page.docs.hello_world }}``` {% endif %} {% if page.docs.extended_description %} ### About {{ page.extension.name }} {{ page.docs.extended_description }} {% endif %} ### Added Functions
| function_name | function_type | description | comment | examples | |-------------------|---------------|-------------|---------|----------| | dplyr | table | NULL | NULL | | | dplyr_pipe_syntax | scalar | NULL | NULL | | | dplyr_with_schema | table | NULL | NULL | | ### Overloaded Functions
This extension does not add any function overloads. ### Added Types
This extension does not add any types. ### Added Settings
| name | description | input_type | scope | aliases | typed_value | |-------------------|---------------------------------------------------------|------------------------------------------|--------|---------|-------------| | dplyr_pipe_syntax | The active database-global dplyr pipe syntax | ENUM('magrittr', 'native', '%>%', '\|>') | GLOBAL | [] | NULL | | temp_directory | Set the directory to which temporary files are written. | VARCHAR | GLOBAL | [] | post.db.tmp |