{"id":13858031,"url":"https://github.com/Nowosad/sabre","last_synced_at":"2025-07-13T23:31:06.335Z","repository":{"id":83717720,"uuid":"126053474","full_name":"Nowosad/sabre","owner":"Nowosad","description":"sabre: Spatial Association Between REgionalizations","archived":false,"fork":false,"pushed_at":"2024-12-14T15:16:42.000Z","size":2860,"stargazers_count":35,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T15:12:38.603Z","etag":null,"topics":["entropy","polygons","r","regionalizations","spatial","spatial-analysis"],"latest_commit_sha":null,"homepage":"https://nowosad.github.io/sabre/","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/Nowosad.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-03-20T17:03:23.000Z","updated_at":"2025-03-22T11:03:16.000Z","dependencies_parsed_at":"2023-03-12T19:30:08.233Z","dependency_job_id":null,"html_url":"https://github.com/Nowosad/sabre","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Nowosad/sabre","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nowosad%2Fsabre","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nowosad%2Fsabre/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nowosad%2Fsabre/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nowosad%2Fsabre/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nowosad","download_url":"https://codeload.github.com/Nowosad/sabre/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nowosad%2Fsabre/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265220241,"owners_count":23729780,"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":["entropy","polygons","r","regionalizations","spatial","spatial-analysis"],"created_at":"2024-08-05T03:01:54.404Z","updated_at":"2025-07-13T23:31:06.326Z","avatar_url":"https://github.com/Nowosad.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 = \"100%\"\n)\n```\n\n# sabre \u003cimg src=\"man/figures/logo.png\" align=\"right\" width=\"150\" /\u003e\n\n[![CRAN status](https://www.r-pkg.org/badges/version/sabre)](https://cran.r-project.org/package=sabre)\n[![R-CMD-check](https://github.com/Nowosad/sabre/workflows/R-CMD-check/badge.svg)](https://github.com/Nowosad/sabre/actions)\n[![codecov](https://app.codecov.io/gh/Nowosad/sabre/branch/master/graph/badge.svg)](https://app.codecov.io/gh/Nowosad/sabre)\n[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/sabre)](https://cran.r-project.org/package=sabre)\n\nThe **sabre** (**S**patial **A**ssociation **B**etween **RE**gionalizations) is an R package for calculating a degree of spatial association between regionalizations or categorical maps.\nThis package offers support for `sf`, `RasterLayer`, `SpatRaster`, and `stars` spatial objects, and the following methods:\n\n* the V-measure method (Nowosad and Stepinski, 2018)\n* the MapCurve method (Hargrove et al., 2006)\n\n## Installation\n\nYou can install the released version of `sabre` from [CRAN](https://cran.r-project.org/package=sabre) with:\n\n``` r\ninstall.packages(\"sabre\")\n```\n\nYou can install the development version from [GitHub](https://github.com/nowosad/sabre) with:\n\n``` r\n# install.packages(\"devtools\")\ndevtools::install_github(\"Nowosad/sabre\")\n```\n## Example\n\nWe use two simple regionalization, `regions1` and `regions2` to show the basic concept of calculating a degree of spatial association. \n\n```{r, message=FALSE, warning=FALSE}\nlibrary(sabre)\nlibrary(sf)\ndata(\"regions1\")\ndata(\"regions2\")\n```\n\nThe first map, `regions1` consists of four regions of the same shape and size, while the second one, `regions2` has three irregular regions.\n\n```{r, echo=FALSE, fig.height=5, out.width=\"50%\"}\nplot(regions1, main = \"regions1\")\nplot(regions2, main = \"regions2\")\n```\n\nThe `vmeasure_calc()` function allows for calculation of a degree of spatial association between regionalizations or categorical maps using the information-theoretical V-measure.\nIt requires, at least, four arguments:\n\n* `x` - an `sf` object containing the first regionalization\n* `x_name` - a name of the column with regions names of the first regionalization\n* `y` - an `sf` object containing the second regionalization\n* `y_name` -  a name of the column with regions names of the second regionalization\n\n```{r}\nregions_vm = vmeasure_calc(x = regions1, y = regions2, x_name = z, y_name = z)\n```\n\nThe result is a list with three metrics of spatial association - `V-measure`, `Homogeneity`, `Completeness` - and two `sf` objects with preprocessed input maps - `$map1` and `$map2`.\n\n```{r}\nregions_vm\n```\n\nBoth spatial outputs have two columns. \nThe first one contains regions' names/values and the second one (`rih`) describes regions' inhomogeneities.\n\n```{r, eval=FALSE}\nplot(regions_vm$map1[\"rih\"], main = \"Map1: rih\")\nplot(regions_vm$map2[\"rih\"], main = \"Map2: rih\")\n```\n\n```{r, warning=FALSE, fig.height=2, fig.height=5, out.width=\"50%\", echo=FALSE}\nplot(regions_vm$map1[\"rih\"], main = \"Map1: rih\"); plot(regions_vm$map2[\"rih\"], main = \"Map2: rih\")\n```\n\nMore examples can be found in [the package vignette](https://jakubnowosad.com/sabre/articles/sabre.html) and in [the sabre: or how to compare two maps? blog post](https://jakubnowosad.com/posts/2018-09-10-sabre-bp/).\n\n\u003c!-- Additionally, examples presented in the [Spatial association between regionalizations using the information-theoretical V-measure](https://doi.org/10.1080/13658816.2018.1511794) article can be reproduced using data available at http://sil.uc.edu/index.php?id=data-1#vmeasure. --\u003e\n\n## Logo\n\nHex logo was created with [hexmake](https://connect.thinkr.fr/hexmake/) using icons made by \u003ca href=\"https://www.flaticon.com/authors/smashicons\" title=\"Smashicons\"\u003eSmashicons\u003c/a\u003e and \u003ca href=\"https://www.flaticon.com/authors/creaticca-creative-agency\" title=\"Creaticca Creative Agency\"\u003eCreaticca Creative Agency\u003c/a\u003e from \u003ca href=\"https://www.flaticon.com/\" title=\"Flaticon\"\u003ewww.flaticon.com\u003c/a\u003e.\n\n## References\n\n- Nowosad, Jakub, and Tomasz F. Stepinski. \"Spatial association between regionalizations using the information-theoretical V-measure.\" International Journal of Geographical Information Science (2018). https://doi.org/10.1080/13658816.2018.1511794\n- Rosenberg, Andrew, and Julia Hirschberg. \"V-measure: A conditional entropy-based external cluster evaluation measure.\" Proceedings of the 2007 joint conference on empirical methods in natural language processing and computational natural language learning (EMNLP-CoNLL). 2007.\n- Hargrove, William W., Forrest M. Hoffman, and Paul F. Hessburg. \"Mapcurves: a quantitative method for comparing categorical maps.\" Journal of Geographical Systems 8.2 (2006): 187.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNowosad%2Fsabre","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNowosad%2Fsabre","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNowosad%2Fsabre/lists"}