{"id":13857813,"url":"https://github.com/crazycapivara/h3-r","last_synced_at":"2025-05-12T20:38:46.869Z","repository":{"id":46975017,"uuid":"165286703","full_name":"crazycapivara/h3-r","owner":"crazycapivara","description":"R bindings for H3,  a hierarchical hexagonal geospatial indexing system","archived":false,"fork":false,"pushed_at":"2022-08-08T08:04:12.000Z","size":874,"stargazers_count":76,"open_issues_count":9,"forks_count":11,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-01T03:12:24.675Z","etag":null,"topics":["geocoding","geospatial","h3","hexagon","r","r-bindings","spatial-indexing"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crazycapivara.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-11T17:58:47.000Z","updated_at":"2025-02-26T13:08:26.000Z","dependencies_parsed_at":"2022-09-13T17:14:18.797Z","dependency_job_id":null,"html_url":"https://github.com/crazycapivara/h3-r","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crazycapivara%2Fh3-r","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crazycapivara%2Fh3-r/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crazycapivara%2Fh3-r/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crazycapivara%2Fh3-r/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crazycapivara","download_url":"https://codeload.github.com/crazycapivara/h3-r/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253817593,"owners_count":21969007,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geocoding","geospatial","h3","hexagon","r","r-bindings","spatial-indexing"],"created_at":"2024-08-05T03:01:47.681Z","updated_at":"2025-05-12T20:38:46.825Z","avatar_url":"https://github.com/crazycapivara.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r setup, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"400px\"\n)\n```\n# H3-R\n\n\u003c!-- badges: start --\u003e\n[![R build status](https://github.com/crazycapivara/h3-r/workflows/R-CMD-check/badge.svg)](https://github.com/crazycapivara/h3-r/actions)\n[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)\n[![H3 Version](https://img.shields.io/badge/h3-v3.7.1-blue.svg)](https://github.com/uber/h3/releases/tag/v3.7.1)\n[![CRAN status](https://www.r-pkg.org/badges/version/h3)](https://CRAN.R-project.org/package=h3)\n\u003c!-- badges: end --\u003e\n\nProvides R bindings for [H3](https://h3geo.org/), a hexagonal hierarchical spatial indexing system.\n\n## Documentation\n\n* [H3-R](https://crazycapivara.github.io/h3-r/)\n* [H3](https://h3geo.org/docs/)\n\n## Notes\n\nSuccesfully built on\n\n* Linux\n* macOS\n* Windows\n\nSince v3.7.1 {h3} comes with a bundled version of the H3 C library, so that you no longer have to build it yourself before installing the R package.\n\n## Installation\n\nOnce on [CRAN](https://cran.r-project.org/) you can install {h3} with:\n\n```r\ninstall.packages(\"h3\")\n```\n\nYou can install the latest version of {h3} from github with:\n\n```{r installation, eval = FALSE}\n# install.packages(\"remotes\")\nremotes::install_github(\"crazycapivara/h3-r\")\n```\n\n## Usage\n\nCore functions:\n\n```{r h3-core}\nlibrary(h3)\n\ncoords \u003c- c(37.3615593, -122.0553238)\nresolution \u003c- 7\n\n# Convert a lat/lng point to a hexagon index at resolution 7\n(h3_index \u003c- geo_to_h3(coords, resolution)) \n\n# Get the center of the hexagon\nh3_to_geo_sf(h3_index)\n\n# Get the vertices of the hexagon\nh3_to_geo_boundary(h3_index)\n\n# Get the polygon of the hexagon\nh3_to_geo_boundary_sf(h3_index)\n```\n\nUseful algorithms:\n\n```{r h3-algorithms}\n# Get all neighbors within 1 step of the hexagon\nradius \u003c- 1\n(neighbors \u003c- k_ring(h3_index, radius))\n\nh3_to_geo_boundary_sf(neighbors) %\u003e%\n  sf::st_geometry() %\u003e% plot(col = \"blue\")\n\nh3_set_to_multi_polygon(neighbors) %\u003e%\n  sf::st_geometry() %\u003e% plot(col = \"green\")\n```\n\n## Run tests\n\n```{r tests}\ndevtools::test(reporter = \"minimal\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrazycapivara%2Fh3-r","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrazycapivara%2Fh3-r","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrazycapivara%2Fh3-r/lists"}