H3 Extension of 'DuckDB'
Overview
Fast & memory-efficient functions to analyze and manipulate large data sets. It leverages the fast analytical capabilities of 'DuckDB' and its spatial extension (see https://duckdb.org/community_extensions/extensions/h3) while maintaining compatibility with R’s spatial data ecosystem to work with spatial vector data.
BUILD
- Requires DuckDB >= 1.5.6
- Requires
duckspatial>= 1.3.0
ENHANCEMENTS
- Functions in vetorized mode automatically parse to UBIGINT when the input is a numeric vector.
- Error message on wrong CRS is now displayed correctly (#3).
NEW FEATURES
- New functions to convert polygon and linestring geometries to H3 cells (#2):
ddbh3_polygons_to_h3()/ddbh3_lines_to_h3()add a list column with the H3 cells intersecting each feature (string orUBIGINT).ddbh3_polygons_to_spatial()/ddbh3_lines_to_spatial()return one row per intersecting cell, with geometry replaced by the cell hexagon boundary.
Show all changes in 0.2.0Hide the rest of the changes in 0.2.0
- Polygons use DuckDB's experimental polygon polyfill (
overlapcontainment by default); lines are polyfilled via a buffer-then-exact-trim strategy since they have no native polyfill (buffer_scaleargument).
From NEWS.md in the release
Install
Health
ERRORexamplesr-devel-linux-x86_64-fedora-clang, r-oldrel-macos-x86_64, r-release-macos-x86_64
r-oldrel-macos-x86_64, r-release-macos-x86_64
Running examples in ‘duckh3-Ex.R’ failed
The error most likely occurred in:
> ### Name: ddbh3_get_child_pos
> ### Title: Get the position of an H3 cell within its parent
> ### Aliases: ddbh3_get_child_pos
>
> ### ** Examples
>
> ## Load needed packages
> library(duckh3)
> library(dplyr)
Attaching package: ‘dplyr’
The following objects are masked from ‘package:stats’:
filter, lag
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
>
> ## Setup the default connection with h3 and spatial extensions
> ## This is a mandatory step to use duckh3 functions
> ddbh3_default_conn(threads = 1)
duckdb is storing downloaded extensions and secrets under ~/.duckdb:
ℹ /Users/urbanek/.duckdb
This persists across sessions and is shared with the DuckDB CLI and other clients.
ℹ Run duckdb(shared_home = FALSE) to use a temporary directory instead.
ℹ See ?duckdb_storage for details and alternatives.
Error in `value[[3L]]()`:
! Failed to load the h3 exte
...[truncated]...
ble architecture (have 'arm64', need
'x86_64h' or 'x86_64')),
'/System/Volumes/Preboot/Cryptexes/OS/Users/urbanek/.duckdb/extensions/v1.5.6/osx_amd64/h3.duckdb_extension'
(no such file),
'/Users/urbanek/.duckdb/extensions/v1.5.6/osx_amd64/h3.duckdb_extension'
(mach-o file, but is an incompatible architecture (have 'arm64', need
'x86_64h' or 'x86_64')) ℹ Context: rapi_execute ℹ Error type: IO
ℹ The binary may be corrupt or incompatible with this platform/DuckDB version.
ℹ Try reinstalling with `ddbs_install(extension = 'h3', upgrade = TRUE)`
Backtrace:
▆
1. └─duckh3::ddbh3_default_conn(threads = 1)
2. └─duckspatial::ddbs_load(conn, quiet = TRUE, extension = "h3")
3. └─base::tryCatch(...)
4. └─base (local) tryCatchList(expr, classes, parentenv, handlers)
5. └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
6. └─value[[3L]](cond)
7. └─cli::cli_abort(...)
8. └─rlang::abort(...)
Execution haltedr-devel-linux-x86_64-fedora-clang
Running examples in ‘duckh3-Ex.R’ failed
The error most likely occurred in:
> ### Name: ddbh3_get_child_pos
> ### Title: Get the position of an H3 cell within its parent
> ### Aliases: ddbh3_get_child_pos
>
> ### ** Examples
>
> ## Load needed packages
> library(duckh3)
> library(dplyr)
Attaching package: ‘dplyr’
The following objects are masked from ‘package:stats’:
filter, lag
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
>
> ## Setup the default connection with h3 and spatial extensions
> ## This is a mandatory step to use duckh3 functions
> ddbh3_default_conn(threads = 1)
duckdb is storing downloaded extensions and secrets under ~/.duckdb:
ℹ /data/localhost/ripley/.duckdb
This persists across sessions and is shared with the DuckDB CLI and other clients.
ℹ Run duckdb(shared_home = FALSE) to use a temporary directory instead.
ℹ See ?duckdb_storage for details and alternatives.
duckdb was built with libc++ (not libstdc++) o
...[truncated]...
! Failed to load the spatial extension.
✖ DuckDB extension loading (INSTALL / LOAD) is disabled for this driver. ℹ
Recreate the driver with duckdb(allow_extensions = TRUE) to enable it (this
may crash R on a Linux build not compiled with libstdc++; see
https://github.com/duckdb/duckdb-r/issues/1107). ℹ See ?duckdb for details. ℹ
Context: load_extension
ℹ The binary may be corrupt or incompatible with this platform/DuckDB version.
ℹ Try reinstalling with `ddbs_install(extension = 'spatial', upgrade = TRUE)`
Backtrace:
▆
1. └─duckh3::ddbh3_default_conn(threads = 1)
2. └─duckspatial::ddbs_create_conn(...)
3. └─duckspatial::ddbs_load(conn, quiet = TRUE)
4. └─base::tryCatch(...)
5. └─base (local) tryCatchList(expr, classes, parentenv, handlers)
6. └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
7. └─value[[3L]](cond)
8. └─cli::cli_abort(...)
9. └─rlang::abort(...)
Execution haltedERRORtestsr-devel-linux-x86_64-fedora-clang, r-oldrel-macos-x86_64, r-release-macos-x86_64
r-oldrel-macos-x86_64, r-release-macos-x86_64
Running ‘testthat.R’ [2s/3s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
> # * https://testthat.r-lib.org/articles/special-files.html
>
> library(testthat)
> library(duckh3)
>
> test_check("duckh3")
duckdb is storing downloaded extensions and secrets under ~/.duckdb:
ℹ /Users/urbanek/.duckdb
This persists across sessions and is shared with the DuckDB CLI and other clients.
ℹ Run duckdb(shared_home = FALSE) to use a temporary directory instead.
ℹ See ?duckdb_storage for details and alternatives.
Error in `source_dir()`:
! Failed to evaluate './setup.R'.
Caused by error in `value[[3L]]()`:
! Failed to load the h3 extension.
✖ IO Error: Ext
...[truncated]...
R]$", env = env, wrap = FALSE)
8. └─base::lapply(...)
9. └─testthat (local) FUN(X[[i]], ...)
10. └─testthat::source_file(...)
11. ├─base::withCallingHandlers(...)
12. └─base::eval(exprs, env)
13. └─base::eval(exprs, env)
14. └─duckh3::ddbh3_default_conn() at ./setup.R:12:1
15. └─duckspatial::ddbs_load(conn, quiet = TRUE, extension = "h3")
16. └─base::tryCatch(...)
17. └─base (local) tryCatchList(expr, classes, parentenv, handlers)
18. └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
19. └─value[[3L]](cond)
20. └─cli::cli_abort(...)
21. └─rlang::abort(...)
Execution haltedr-devel-linux-x86_64-fedora-clang
Running ‘testthat.R’
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
> # * https://testthat.r-lib.org/articles/special-files.html
>
> library(testthat)
> library(duckh3)
>
> test_check("duckh3")
duckdb is storing downloaded extensions and secrets under ~/.duckdb:
ℹ /data/localhost/ripley/.duckdb
This persists across sessions and is shared with the DuckDB CLI and other clients.
ℹ Run duckdb(shared_home = FALSE) to use a temporary directory instead.
ℹ See ?duckdb_storage for details and alternatives.
duckdb was built with libc++ (not libstdc++) on Linux, so DuckDB extensions are disabled:
• Loading a prebuilt (libstdc++) extension could crash R (htt
...[truncated]...
(...)
9. └─testthat (local) FUN(X[[i]], ...)
10. └─testthat::source_file(...)
11. ├─base::withCallingHandlers(...)
12. └─base::eval(exprs, env)
13. └─base::eval(exprs, env)
14. └─duckh3::ddbh3_default_conn() at ./setup.R:12:1
15. └─duckspatial::ddbs_create_conn(...)
16. └─duckspatial::ddbs_load(conn, quiet = TRUE)
17. └─base::tryCatch(...)
18. └─base (local) tryCatchList(expr, classes, parentenv, handlers)
19. └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
20. └─value[[3L]](cond)
21. └─cli::cli_abort(...)
22. └─rlang::abort(...)
Execution halted- ERROR10 OK, 3 ERRORNow
- ERROR10 OK, 1 ERROR2026-04-28
- OK5 OK2026-04-25
Documentation
- Help pages
- 12
- Examples that run
- 67%8 run in a plain check · 3 only when donttest examples are enabled (R CMD check --as-cran) · 1 hold no code
- Exported functions with examples
- 100%
- Documented parameters
- 100%
- Return-value docs
- 100%
- Help pages citing references
- 0%
Downloads
Repository
- PRs merged (all time)
- 100%
- Median days to close, 50 most recently updated closed issues
- 34
- Median days to close, 50 most recently updated closed PRs
- 0
Stars over time
Releases over time
Issues over time
PRs over time
Commits over time
10 development-tooling and community-health practices detected across 6 families in the upstream repository
Checks run against github.com/cidree/duckh3 on 2026-10-21.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-10-17 · The repository has a site deploy workflow
pkgdown site last built 2026-10-17
Show all practicesHide 2 practices
This repository shows signs of AI coding tools.
- Claude Codefirst seen 2026-10-19Pull request it wrote: opened by a project member
Dependencies
Code & Tests
Datasets
People & History
Pick two releases to compare their code metrics.
- 0.2.0Latest2026-10-11 · current release · diff ↗ ·
added 4 exports
ddbh3_lines_to_h3, ddbh3_lines_to_spatial, ddbh3_polygons_to_h3, ddbh3_polygons_to_spatial - 0.1.02026-04-24
- RR 4.6.0 released · 2026-04-24
- RR 4.5.0 released · 2025-04-11
Package metadata
- First published
- 2026-04-24
- Total releases
- 2 / 1 yrs
- License
- GPL (>= 3) OSI
- Minimum R
- ≥ 4.1.0
- Download size
- 1.6 MB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("duckh3")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-23, which the citation names so these numbers can be found later. More on citing and the projects behind them.