{"id":22851983,"url":"https://github.com/vgherard/r2r","last_synced_at":"2025-04-30T09:17:18.371Z","repository":{"id":56934792,"uuid":"363068140","full_name":"vgherard/r2r","owner":"vgherard","description":"R-Object to R-Object Hash Maps","archived":false,"fork":false,"pushed_at":"2024-11-09T10:26:37.000Z","size":371,"stargazers_count":4,"open_issues_count":4,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-30T09:17:07.314Z","etag":null,"topics":["data-structures","hashtable","r"],"latest_commit_sha":null,"homepage":"https://vgherard.github.io/r2r/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vgherard.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":"2021-04-30T07:54:17.000Z","updated_at":"2025-03-28T18:24:06.000Z","dependencies_parsed_at":"2022-08-21T00:30:06.988Z","dependency_job_id":null,"html_url":"https://github.com/vgherard/r2r","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vgherard%2Fr2r","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vgherard%2Fr2r/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vgherard%2Fr2r/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vgherard%2Fr2r/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vgherard","download_url":"https://codeload.github.com/vgherard/r2r/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251674590,"owners_count":21625646,"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":["data-structures","hashtable","r"],"created_at":"2024-12-13T06:06:40.009Z","updated_at":"2025-04-30T09:17:18.342Z","avatar_url":"https://github.com/vgherard.png","language":"R","funding_links":[],"categories":[],"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, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# r2r\n\n\u003c!-- badges: start --\u003e\n[![CRAN status](https://www.r-pkg.org/badges/version/r2r)](https://CRAN.R-project.org/package=r2r)\n[![R-CMD-check](https://github.com/vgherard/r2r/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/vgherard/r2r/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/vgherard/r2r/graph/badge.svg)](https://app.codecov.io/gh/vgherard/r2r)\n[![R-universe status](https://vgherard.r-universe.dev/badges/r2r)](https://vgherard.r-universe.dev/)\n[![Website](https://img.shields.io/badge/Website-here-blue)](https://vgherard.github.io/r2r/)\n[![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text={r2r}:%20R-Object%20to%20R-Object%20Hash%20Maps\u0026url=https://vgherard.github.io/r2r\u0026via=ValerioGherardi\u0026hashtags=rstats,datastructures,hashtables)\n\u003c!-- badges: end --\u003e\n\n[`r2r`](https://vgherard.github.io/r2r/) provides a flexible implementation of hash tables in R, allowing for:\n\n- arbitrary R objects as keys and values,\n- arbitrary key comparison and hash functions,\n- customizable behaviour (throw or return a default value) on missing key exceptions.\n\n## Installation\n\nYou can install the released version of `r2r` from [CRAN](https://CRAN.R-project.org/package=r2r) with:\n\n``` r\ninstall.packages(\"r2r\")\n```\n\nand the development version from [my R-universe repository](https://vgherard.r-universe.dev/), with:\n\n``` r\ninstall.packages(\"r2r\", repos = \"https://vgherard.r-universe.dev\")\n```\n\n## Usage\n\n```{r}\nlibrary(r2r)\nm \u003c- hashmap()\n\n# Insert and query a single key-value pair\nm[[ \"user\" ]] \u003c- \"vgherard\"\nm[[ \"user\" ]]\n\n# Insert and query multiple key-value pairs\nm[ c(1, 2, 3) ] \u003c- c(\"one\", \"two\", \"three\")\nm[ c(1, 3) ]\n\n# Keys and values can be arbitrary R objects\nm[[ lm(mpg ~ wt, mtcars) ]] \u003c- c(TRUE, FALSE, TRUE)\nm[[ lm(mpg ~ wt, mtcars) ]]\n```\n\n## Getting help\n\nFor further details, including an introductory vignette illustrating the features of `r2r` hash maps, you can consult the `r2r` [website](https://vgherard.github.io/r2r/). If you encounter a bug, want to suggest a feature or need further help, you can [open a GitHub issue](https://github.com/vgherard/r2r/issues).\n\n## Comparison with `hash`\n\nCRAN package [`{hash}`](https://CRAN.R-project.org/package=hash) also offers an implementation of hash tables based on R environments. The two tables below offer a comparison between `{r2r}` and `{hash}` (for more details, see the [benchmarks](https://vgherard.github.io/r2r/articles/benchmarks.html) Vignette)\n\n```{r echo=FALSE}\nknitr::kable(\n\tdata.frame(\n\t\tFeature = c(\n\t\t\t\"Basic data structure\",\n\t\t\t\"Arbitrary type keys\", \n\t\t\t\"Arbitrary type values\",\n\t\t\t\"Arbitrary hash function\",\n\t\t\t\"Arbitrary key comparison function\",\n\t\t\t\"Throw or return default on missing keys\",\n\t\t\t\"Hash table inversion\"\n\t\t),\n\t\tr2r = c(\"R environment\", \"X\", \"X\", \"X\", \"X\", \"X\", \"\"),\n\t\thash = c(\"R environment\", \"\", \"X\", \"\", \"\", \"\", \"X\")\n\t\t),\n\talign = \"c\",\n\tcaption = \"Features supported by {r2r} and {hash}.\"\n\t)\n```\n\n```{r echo=FALSE}\nknitr::kable(\n\tdata.frame(\n\t\tTask = c(\n\t\t\t\"Key insertion\",\n\t\t\t\"Key query\",\n\t\t\t\"Key deletion\"\n\t\t\t),\n\t\tComparison = c(\n\t\t\t\"{r2r} ~ {hash}\",\n\t\t\t\"{r2r} \u003c {hash}\",\n\t\t\t\"{r2r} \u003c\u003c {hash}\"\n\t\t\t)\n\t\t),\n\talign = \"c\",\n\tcaption = \"Performances of {r2r} and {hash} for basic hash table operations.\"\n\t)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvgherard%2Fr2r","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvgherard%2Fr2r","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvgherard%2Fr2r/lists"}