{"id":351801,"name":"Makurhini","description":"An R package for comprehensive analysis of landscape fragmentation and connectivity.","url":"https://github.com/connectscape/makurhini","last_synced_at":"2026-05-13T11:30:34.223Z","repository":{"id":44707054,"uuid":"237120425","full_name":"connectscape/Makurhini","owner":"connectscape","description":"Landscape fragmentation and connectivity analysis","archived":false,"fork":false,"pushed_at":"2026-03-02T03:59:41.000Z","size":88401,"stargazers_count":55,"open_issues_count":14,"forks_count":18,"subscribers_count":5,"default_branch":"master","last_synced_at":"2026-04-23T02:02:21.920Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://connectscape.github.io/Makurhini/","language":"HTML","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/connectscape.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,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-01-30T01:55:44.000Z","updated_at":"2026-04-16T12:10:45.000Z","dependencies_parsed_at":"2025-01-09T05:18:45.017Z","dependency_job_id":"769cf4bf-ef6c-46fb-9fb4-861a6b3ea613","html_url":"https://github.com/connectscape/Makurhini","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/connectscape/Makurhini","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/connectscape%2FMakurhini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/connectscape%2FMakurhini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/connectscape%2FMakurhini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/connectscape%2FMakurhini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/connectscape","download_url":"https://codeload.github.com/connectscape/Makurhini/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/connectscape%2FMakurhini/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32486222,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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"}},"owner":null,"packages":[],"commits":{"id":11717045,"full_name":"connectscape/Makurhini","default_branch":"master","total_commits":308,"total_committers":5,"total_bot_commits":0,"total_bot_committers":0,"mean_commits":61.6,"dds":0.5357142857142857,"past_year_total_commits":17,"past_year_total_committers":2,"past_year_total_bot_commits":0,"past_year_total_bot_committers":0,"past_year_mean_commits":8.5,"past_year_dds":0.23529411764705888,"last_synced_at":"2026-05-09T10:01:02.841Z","last_synced_commit":"10358291704fe35632c11df21afdf008613208e2","created_at":"2026-04-15T08:57:07.927Z","updated_at":"2026-05-09T10:00:58.959Z","committers":[{"name":"connectscape","email":"connectscape.project@gmail.com","login":"connectscape","count":143},{"name":"OscarGOGO","email":"oscjaguar@gmail.com","login":"OscarGOGO","count":105},{"name":"OscarGOGOO","email":"you@example.com","login":"invalid-email-address","count":51},{"name":"Oscar Godinez Gomez","email":"ogodinez@conabio.gob.mx","login":null,"count":5},{"name":"OscarGOGO","email":"“oscjaguar@gmail.com","login":null,"count":4}],"past_year_committers":[{"name":"OscarGOGO","email":"oscjaguar@gmail.com","login":"OscarGOGO","count":13},{"name":"OscarGOGOO","email":"you@example.com","login":"invalid-email-address","count":4}],"commits_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub/repositories/connectscape%2FMakurhini/commits","host":{"name":"GitHub","url":"https://github.com","kind":"github","last_synced_at":"2026-05-11T00:00:23.725Z","repositories_count":6232552,"commits_count":895041184,"contributors_count":34895385,"owners_count":1151501,"icon_url":"https://github.com/github.png","host_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub/repositories"}},"issues_stats":{"full_name":"connectscape/Makurhini","html_url":"https://github.com/connectscape/Makurhini","last_synced_at":"2026-04-29T05:01:08.608Z","status":"error","issues_count":12,"pull_requests_count":0,"avg_time_to_close_issue":25171214.0,"avg_time_to_close_pull_request":null,"issues_closed_count":1,"pull_requests_closed_count":0,"pull_request_authors_count":0,"issue_authors_count":8,"avg_comments_per_issue":0.16666666666666666,"avg_comments_per_pull_request":null,"merged_pull_requests_count":0,"bot_issues_count":0,"bot_pull_requests_count":0,"past_year_issues_count":8,"past_year_pull_requests_count":0,"past_year_avg_time_to_close_issue":null,"past_year_avg_time_to_close_pull_request":null,"past_year_issues_closed_count":0,"past_year_pull_requests_closed_count":0,"past_year_pull_request_authors_count":0,"past_year_issue_authors_count":4,"past_year_avg_comments_per_issue":0.0,"past_year_avg_comments_per_pull_request":null,"past_year_bot_issues_count":0,"past_year_bot_pull_requests_count":0,"past_year_merged_pull_requests_count":0,"created_at":"2025-08-29T18:21:06.768Z","updated_at":"2026-04-29T05:01:08.608Z","repository_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories/connectscape%2FMakurhini","issues_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories/connectscape%2FMakurhini/issues","issue_labels_count":{},"pull_request_labels_count":{},"issue_author_associations_count":{"NONE":12},"pull_request_author_associations_count":{},"issue_authors":{"JoryGriffith":3,"LeofkJ":2,"tretherington":2,"jmlord":1,"dejong23":1,"jfmas":1,"jdertien":1,"MalejaProCAT":1},"pull_request_authors":{},"host":{"name":"GitHub","url":"https://github.com","kind":"github","last_synced_at":"2026-05-09T00:00:07.995Z","repositories_count":14541810,"issues_count":34231382,"pull_requests_count":112169329,"authors_count":11258205,"icon_url":"https://github.com/github.png","host_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories","owners_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/owners","authors_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors"},"past_year_issue_labels_count":{},"past_year_pull_request_labels_count":{},"past_year_issue_author_associations_count":{"NONE":7},"past_year_pull_request_author_associations_count":{},"past_year_issue_authors":{"JoryGriffith":3,"LeofkJ":2,"tretherington":2},"past_year_pull_request_authors":{},"maintainers":[],"active_maintainers":[]},"events":{"total":{"DeleteEvent":1,"ForkEvent":1,"IssuesEvent":12,"WatchEvent":8,"IssueCommentEvent":3,"PushEvent":28},"last_year":{"IssuesEvent":7,"WatchEvent":2,"IssueCommentEvent":2,"PushEvent":12}},"keywords":[],"dependencies":[{"ecosystem":"cran","filepath":"DESCRIPTION","sha":null,"kind":"manifest","created_at":"2022-09-11T20:21:14.358Z","updated_at":"2022-09-11T20:21:14.358Z","repository_link":"https://github.com/connectscape/Makurhini/blob/master/DESCRIPTION","dependencies":[{"id":4526557550,"package_name":"methods","ecosystem":"cran","requirements":"*","direct":true,"kind":"depends","optional":false},{"id":4526557555,"package_name":"utils","ecosystem":"cran","requirements":"*","direct":true,"kind":"depends","optional":false},{"id":4526557557,"package_name":"stats","ecosystem":"cran","requirements":"*","direct":true,"kind":"depends","optional":false},{"id":4526557559,"package_name":"R","ecosystem":"cran","requirements":"\u003e= 4.0.0","direct":true,"kind":"depends","optional":false},{"id":4526557561,"package_name":"igraph","ecosystem":"cran","requirements":"\u003e= 1.2.6","direct":true,"kind":"depends","optional":false},{"id":4526557563,"package_name":"sf","ecosystem":"cran","requirements":"\u003e= 1.0.2","direct":true,"kind":"imports","optional":false},{"id":4526557564,"package_name":"purrr","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":4526557566,"package_name":"raster","ecosystem":"cran","requirements":"\u003e= 3.4.5","direct":true,"kind":"imports","optional":false},{"id":4526557568,"package_name":"rmapshaper","ecosystem":"cran","requirements":"\u003e= 0.4.4","direct":true,"kind":"imports","optional":false},{"id":4526557570,"package_name":"future","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":4526557572,"package_name":"furrr","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":4526557574,"package_name":"magrittr","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":4526557576,"package_name":"gdistance","ecosystem":"cran","requirements":"\u003e= 1.3.6","direct":true,"kind":"imports","optional":false},{"id":4526557578,"package_name":"rgeos","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":4526557579,"package_name":"data.table","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":4526557581,"package_name":"formattable","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":4526557583,"package_name":"spex","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":4526557585,"package_name":"boot","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":4526557586,"package_name":"tools","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":4526557588,"package_name":"ps","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":4526557590,"package_name":"rlang","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":4526557592,"package_name":"graph4lg","ecosystem":"cran","requirements":"\u003e= 1.0.1","direct":true,"kind":"imports","optional":false},{"id":4526557594,"package_name":"parallel","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":4526557598,"package_name":"crayon","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":4526557600,"package_name":"progressr","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":4526557602,"package_name":"terra","ecosystem":"cran","requirements":"\u003e= 1.3.22","direct":true,"kind":"imports","optional":false},{"id":4526557604,"package_name":"sp","ecosystem":"cran","requirements":"\u003e= 1.4.4","direct":true,"kind":"imports","optional":false},{"id":4526557606,"package_name":"ggplot2","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":4526557608,"package_name":"ggpubr","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":4526557610,"package_name":"knitr","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":4526557611,"package_name":"rmarkdown","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false}]}],"score":5.84354441703136,"created_at":"2026-04-15T08:57:09.605Z","updated_at":"2026-05-13T11:30:34.225Z","avatar_url":"https://github.com/connectscape.png","language":"HTML","category":"Biosphere","sub_category":"Conservation and Restoration","monthly_downloads":0,"total_dependent_repos":0,"total_dependent_packages":0,"readme":"---\noutput: github_document\neditor_options: \n  markdown: \n    wrap: 72\n---\n\n[![AppVeyor build\nstatus](https://ci.appveyor.com/api/projects/status/github/OscarGOGO/Makurhini?branch=master\u0026svg=true)](https://ci.appveyor.com/project/OscarGOGO/Makurhini)\n\n[![Lifecycle:\nexperimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)\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 = \"60%\",\n  message=FALSE, warning=FALSE\n)\n```\n\n# Makurhini: An R package for comprehensive analysis of landscape fragmentation and connectivity.\n\n![](man/figures/LOGO_MAKHURINI.png)\n\n## NEWS\n\nThank you for using Makurhini. **We have a new version Makurhini 3.0!**\n\n1.  We have a new preprint: Godínez-Gómez, O., Correa-Ayram, C.,\n    Goicolea, T., \u0026 Saura, S. (2025). **Makurhini: An R package for\n    comprehensive analysis of landscape fragmentation and\n    connectivity.** Research Square.\n    \u003chttps://doi.org/10.21203/rs.3.rs-6398746/v1\u003e\n\n2.  The **MK_dPCIIC()** function now includes full support for the \n    three essential PC/IIC fractions, offering a much richer portrayal of\n    landscape connectivity. These fractions capture intra-patch \n    connectivity (*intra*), direct inter-patch links (*direct*), and \n    stepwise connectivity through intermediate patches (*step*). \n    This enhancement provides users with a more nuanced and interpretable\n    breakdown of how different components of the landscape contribute\n    to overall connectivity (for details, see Saura, Bodin \u0026 Fortin, \n    2014; https://doi.org/10.1111/1365-2664.12179).\n\n3.  We also introduced the new **MK_dPC_SAMC()** function, which brings powerful\n    functionality for estimating overall landscape connectivity and the \n    importance of each habitat patch using the Probability of \n    Connectivity (PC) index. This function leverages a Spatial Absorbing \n    Markov Chain (SAMC) framework to model movement and settlement as \n    a random-walk dispersal process, enabling a realistic, spatially \n    explicit representation of how species traverse heterogeneous \n    landscapes (for details, see Fletcher et al., \n    2023; https://doi.org/10.1111/ele.13333).\n\n4.  Two new functions have been added: **MK_dPCIIC_links and\n    MK_Focal_nodes**. The first one is used to estimate the link\n    importance for conservation and restoration. The second estimates\n    the focal Integral Index of Connectivity (IIC~f~) or the focal\n    Probability of Connectivity (PC~f~) under one or more distance\n    thresholds. Furthermore, this function estimates the composite\n    connectivity index (CCI~f~; for further details, please see\n    Latorre-Cárdenas et al., 2023.\n    \u003chttps://doi.org/10.3390/land12030631\u003e).\n\n## Overview\n\n**Makurhini** *(Connect in Purépecha language)* is an R package for\ncalculating fragmentation and landscape connectivity indices used in\nconservation planning. Makurhini provides a set of functions to identify\nconnectivity of protected areas networks and the importance of landscape\nelements for maintaining connectivity. This package allows the\nevaluation of scenarios under landscape connectivity changes and\npresents an additional improvement, the inclusion of landscape\nheterogeneity as a constraining factor for connectivity.\n\nThe network connectivity indices calculated in Makurhini package have\nbeen previously published (e.g., Pascual-Hortal \u0026 Saura, 2006.\n*Landscape ecology*, \u003chttps://doi.org/10.1007/s10980-006-0013-z\u003e; Saura\n\u0026 Pascual-Hortal, 2007. *Lanscape and urban planning*,\n\u003chttps://doi.org/10.1016/j.landurbplan.2007.03.005\u003e; Saura \u0026 Rubio,\n2010. *Ecography*, \u003chttps://doi.org/10.1111/j.1600-0587.2009.05760.x\u003e;\nSaura et al., 2011. *Ecological indicators*,\n\u003chttps://doi.org/10.1016/j.ecolind.2010.06.011\u003e; Saura et al., 2017.\n*Ecological indicators*,\n\u003chttp://dx.doi.org/10.1016/j.ecolind.2016.12.047\u003e; Saura et al., 2018.\n*Biological conservation*,\n\u003chttps://doi.org/10.1016/j.biocon.2017.12.020\u003e), and it allows the\nintegration of efficient and useful workflow for landscape management\nand monitoring of global conservation targets.\n\n### Citing Makurhini package\n\nWe will soon publish a paper about this package. Until then, please use\nthe following **Preprint**:\n\nGodínez-Gómez, O., Correa-Ayram, C., Goicolea, T., \u0026 Saura, S. (2025).\nMakurhini: An R package for comprehensive analysis of landscape\nfragmentation and connectivity. Research Square.\n\u003chttps://doi.org/10.21203/rs.3.rs-6398746/v1\u003e\n\n## Installation\n\n-   Depends: R (\\\u003e 4.0.0), igraph (\\\u003e= 1.2.6)\n-   Pre-install\n    [Rtools](https://cran.r-project.org/bin/windows/Rtools/).\n-   Pre-install devtools (\u003ccode\u003einstall.packages(\"devtools\")\u003c/code\u003e) and\n    remotes (\u003ccode\u003einstall.packages(\"remotes\")\u003c/code\u003e) packages.\n-   **It is recommended to install the R igraph package (\\\u003e= 1.2.6)\n    beforehand.**\n\nYou can install the released version of Makurhini from\n[GitHub](https://github.com) with:\n\n```{r echo=TRUE, eval=FALSE}\nlibrary(devtools)\nlibrary(remotes)\ninstall_github(\"connectscape/Makurhini\", dependencies = TRUE, upgrade = \"never\")\n```\n\nIn case it does not appear in the list of packages, close the R session\nand reopen.\n\n**If the following error occurs during installation**:\n\n```{r eval=FALSE}\nUsing github PAT\nfrom envvar GITHUB_PAT Error: Failed to install 'unknown package' from\nGitHub: HTTP error 401. Bad credentials\n\n```\n\nThen you can **try the following**:\n\n```{r eval=FALSE}\nSys.getenv(\"GITHUB_PAT\")\nSys.unsetenv(\"GITHUB_PAT\")\n```\n\n## Makurhini on Linux\n\nTo install Makurhini on linux consider the following steps:\n\n1)  Use the **Linux command line** to install the *unit* package:\n\n    `sudo apt-get install -y libudunits2-dev`\n\n2)  Use the **Linux command line** to install *gdal*:\n\n    `sudo apt install libgdal-dev`\n\n3)  Use the **Linux command line** to install *libfontconfig* and\n    *libharfbuzz*:\n\n    `sudo apt install libfontconfig1-dev`\n\n    `sudo apt install libharfbuzz-dev libfribidi-dev`\n\n4)  You can now install the *devtools* and *remotes* packages, and the\n    *terra*, *raster* and *sf* packages directly in your **R or\n    RStudio**.\n\n    `install.packages(c('remotes', 'devtools', 'terra', 'raster', 'sf'))`\n\n5)  Use the **Linux command line** to install *igraph*:\n\n    `sudo apt-get install libnlopt-dev`\n\n    `sudo apt-get install r-cran-igraph`\n\n6)  You can now install the *gdistance*, *graph4lg* and *ggpubr*\n    packages directly in your **R or RStudio.**\n\n    `install.packages(c('gdistance', 'graph4lg', 'ggpubr'))`\n\n7)  Now you can install Makurhini directly in your **R or RStudio.**\n\n```{r echo=TRUE, eval=FALSE}\nlibrary(devtools)\nlibrary(remotes)\ninstall_github(\"connectscape/Makurhini\", dependencies = TRUE, upgrade = \"never\")\n```\n\nNote that the installation of Makurhini on Linux depends on your version\nof operating system and that you manage to install the packages that\nMakurhini depends on.\n\n## Summary of main *Makurhini* functions\n\n```{r echo=FALSE}\nlibrary(formattable)\nfunctions_MK \u003c- data.frame(Function = c(\"MK_Fragmentation\", \"distancefile\", \"MK_RMCentrality\", \"MK_BCentrality\",  \"MK_dPCIIC\", \"MK_dECA\", \"MK_ProtConn\", \"MK_ProtConnMult\", \"MK_ProtConn_raster\", \"MK_Connect_grid\",\n\"MK_dPCIIC_links\", \"MK_Focal_nodes\", \"test_metric_distance\"), Purpose = c(\"Calculate patch and landscape statistics (e.g., mean size patches, edge density, core area percent, shape index, fractal dimension index, effective mesh size).\", \"Get a table or matrix with the distances between pairs of nodes. Two Euclidean distances ('centroid' and 'edge') and two cost distances that consider the landscape heterogeneity ('least-cost' and 'commute-time, this last is analogous to the resistance distance of circuitscape, see ’gdistance’ package).\", \"Estimate centrality measures under one or several dispersal distances (e.g., betweenness centrality, node memberships, modularity). It uses the 'distancefile ()' to calculate the distances of the nodes so they can be calculated using Euclidean or cost distances that consider the landscape heterogeneity.\", \"Calculate the BC, BCIIC and BCPC indexes under one or several distance thresholds using the command line of CONEFOR. It uses the 'distancefile ()' to calculate the distances of the nodes so they can be calculated using Euclidean or cost distances that consider the landscape heterogeneity\", \"Calculate the integral index of connectivity (IIC) and probability of connectivity (PC) indices under one or several dispersal distances. It computes overall and index fractions (dPC or dIIC, intra, flux and connector) and the effect of restauration in the landscape connectivity when adding new nodes (restoration scenarios). It uses the 'distancefile()'.\", \"Estimate the Equivalent Connected Area (ECA) and compare the relative change in ECA (dECA) between time periods using one or several dispersal distances. It uses the 'distancefile()'.\", \"Estimate the Protected Connected (ProtConn) indicator and fractions for one region using one or several dispersal distances and transboundary buffer areas (e.g., ProtConn, ProtUnconn, RelConn, ProtConn[design], ProtConn[bound], ProtConn[Prot], ProtConn[Within], ProtConn[Contig], ProtConn[Trans], ProtConn[Unprot]). It uses the 'distancefile(). This function estimates what we call the ProtConn delta (dProtConn) which estimates the contribution of each protected area to connectivity in the region (ProtConn value)\", \"Estimate the ProtConn indicator and fractions for multiple regions. It uses the 'distancefile()'.\", \"Estimate Protected Connected (ProtConn) indicator and fractions for one region using raster inputs (nodes and region). It uses the 'distancefile()'.\", \"Compute the ProtConn indicator and fractions, PC or IIC overall connectivity metrics (ECA) in a regular grid. It uses the 'distancefile()'.\", \"Estimate the link importance for conservation and restoration. It calculates the contribution of each individual link to maintain (mode: link removal) or improve (mode: link change) the overall connectivity.\", \"Estimate the focal Integral Index of Connectivity or the focal Probability of Connectivity  and the Composite Connectivity Index under one or more distance thresholds.\", \"Compare ECA or ProtConn connectivity metrics using one or up to four types of distances, computed in the 'distancefile()' function, and multiple dispersion distances.\"))\n\nformattable(functions_MK,  align =c(\"l\",\"l\"), list(`Function` = formatter(\n              \"span\", style = ~ style(font.style = \"italic\"))))\n\n```\n\n## Examples\n\n-   [Fragmentation statistics]\n\n-   [Centrality measures] (e.g., betweenness centrality, node\n    memberships, and modularity)\n\n-   [Probability of connectivity (PC) and fractions (Intra, Flux and\n    Connector)](#probability-of-connectivity-pc-and-fractions-intra-flux-and-connector)\n\n-   [Equivalent Connectivity Area\n    (ECA)](#equivalent-connectivity-area-eca)\n\n-   [Protected Connected Land\n    (ProtConn)](#protected-connected-land-protconn)\n\n```{r echo=FALSE, warning=FALSE, message=FALSE}\nlibrary(Makurhini)\nlibrary(sf)\nlibrary(raster)\nlibrary(terra)\nlibrary(tmap)\nlibrary(mapview)\nlibrary(classInt)\nlibrary(ggplot2)\nlibrary(rmapshaper)\nsetwd(getwd())\n```\n\n### Fragmentation statistics\n\n*'MK_Fragmentation()'* estimates fragmentation statistics at the\nlandscape and patch/node level.\n\nIn this example, the `MK_Fragmentation()` function was applied to\nestimate fragmentation indices on 404 remaining habitat fragments, which\nwere modeled for 40 species of non-flying mammals of the Trans-Mexican\nVolcanic System (TMVS) by Correa Ayram et al., (2017).\n\n```{r }\ndata(\"habitat_nodes\", package = \"Makurhini\")\nnrow(habitat_nodes) # Number of nodes\n```\n\nTo define the edge of the nodes we can use, for example, a distance of\n500 m from the limit of the nodes.\n\n![](man/figures/Imagen1.png)\n\n```{r }\nFragmentation_test \u003c- MK_Fragmentation(nodes = habitat_nodes, edge_distance = 500,\n                                       plot = TRUE, min_node_area = 100, \n                                       landscape_area = NULL, area_unit = \"km2\", \n                                       perimeter_unit = \"km\")\n\n```\n\n-   The results are presented as a list, the first result is called\n    *\"Summary landscape metrics (Viewer Panel)\"* and it has\n    fragmentation statistics at landscape level.\n\n```{r }\nclass(Fragmentation_test)\nnames(Fragmentation_test)\nFragmentation_test$`Summary landscape metrics (Viewer Panel)`\n```\n\n-   The second output *\"Patch statistics shapefile\"* is a shapefile with\n    patch level fragmentation statistics that can be saved using\n    write_sf() from *'sf'* package\n    (\u003chttps://cran.r-project.org/web/packages/sf/index.html\u003e).\n\n```{r }\nhead(Fragmentation_test[[2]])\n```\n\n```{r eval = FALSE, echo=FALSE, out.width = \"100%\", message=FALSE, warning=FALSE}\nlibrary(classInt)\ntmap_mode(\"plot\")\nc \u003c-9\nCAP \u003c- tm_shape(Fragmentation_test[[2]]) + \n  tm_fill(\"CAPercent\", \n          fill.scale = tm_scale(breaks = classIntervals(Fragmentation_test[[2]]$CAPercent, c, \"jenks\")[[2]],\n                                values = RColorBrewer::brewer.pal(c, \"RdYlGn\")))+ \n  tm_shape(TMVS) + tm_borders(lwd = 1.5)+ tm_layout(legend.width = 4.3, \n                                                    legend.height = 5.6,\n                                                    legend.position = c(-0.01, 0.3),\n                                                    legend.text.size = 1,\n                                                    legend.title.size = 0.7) \n  #tm_title(\"Core Area %\", position = c(\"center\", \"top\"))+\n\nPer \u003c- tm_shape(Fragmentation_test[[2]]) + \n  tm_fill(\"Perimeter\", \n          fill.scale = tm_scale(breaks = classIntervals(Fragmentation_test[[2]]$Perimeter, c, \"jenks\")[[2]],\n                                values = RColorBrewer::brewer.pal(c, \"RdYlGn\")))+ \n  tm_shape(TMVS) + tm_borders(lwd = 1.5)+ tm_layout(legend.width = 4.3, \n                                                    legend.height = 5.6,\n                                                    legend.position = c(-0.01, 0.3),\n                                                    legend.text.size = 1,\n                                                    legend.title.size = 0.7) \n\nSH \u003c- tm_shape(Fragmentation_test[[2]]) + \n  tm_fill(\"ShapeIndex\", \n          fill.scale = tm_scale(breaks = classIntervals(Fragmentation_test[[2]]$ShapeIndex, c, \"jenks\")[[2]],\n                                values = RColorBrewer::brewer.pal(c, \"RdYlGn\")))+ \n  tm_shape(TMVS) + tm_borders(lwd = 1.5)+ tm_layout(legend.width = 4.3, \n                                                    legend.height = 5.6,\n                                                    legend.position = c(-0.01, 0.3),\n                                                    legend.text.size = 1,\n                                                    legend.title.size = 0.7) \n\nFrac \u003c- tm_shape(Fragmentation_test[[2]]) + \n  tm_fill(\"FRAC\", \n          fill.scale = tm_scale(breaks = classIntervals(Fragmentation_test[[2]]$FRAC, c, \"quantile\")[[2]],\n                                values = RColorBrewer::brewer.pal(c, \"RdYlGn\"),\n                                midpoint = NA))+ \n  tm_shape(TMVS) + tm_borders(lwd = 1.5)+ tm_layout(legend.width = 4.3, \n                                                    legend.height = 5.6,\n                                                    legend.position = c(-0.01, 0.3),\n                                                    legend.text.size = 1,\n                                                    legend.title.size = 0.7) \n\ntmap_arrange(CAP, Per, SH, Frac)\n\n```\n\n![](images/example_fragm.png)\n\nWe can make a loop where we explore different edge depths. In the\nfollowing example, We will explore 10 edge depths (*edge_distance\nargument*): 100, 200, 300, 400, 500, 600, 700, 800, 900 and 1000 meters.\nWe will apply the *'MK_Fragmentation()'* function using the previous\ndistances and then, we will extract the core area percentage and edge\npercentage statistics. Finally, we will plot the average of the patch\ncore area percentage and edge percentage (% core area + % edge = 100%).\n\n```{r echo=TRUE}\nlibrary(purrr)\nFragmentation_test.2 \u003c- map_dfr(seq(100, 1000, 100), function(x){\n  x.1 \u003c- MK_Fragmentation(nodes = habitat_nodes, \n                          edge_distance = x, plot = FALSE)[[2]]\n  CA \u003c- mean(x.1$CAPercent)\n  Edge \u003c- mean(x.1$EdgePercent)\n  x.2 \u003c- rbind(data.frame('Edge distance' = x, Type = \"Core Area\", Percentage = CA),\n                     data.frame('Edge distance' = x, Type = \"Edge\", Percentage = Edge))\n  return(x.2)\n})\n\n```\n\n```{r echo=FALSE}\nlibrary(ggplot2)\nggplot(Fragmentation_test.2, aes(x = Edge.distance, y = Percentage, group = Type)) +\n  geom_line(aes(color = Type))+\n  geom_point(aes(color = Type))+ ylim(0,100)+\n  scale_x_continuous(\"Edge depth distance (m)\", \n                     labels = as.character(Fragmentation_test.2$Edge.distance), breaks = Fragmentation_test.2$Edge.distance)+\n  scale_color_brewer(palette=\"Dark2\")+\n  theme_classic()\n```\n\nThe mean core area percentage (the mean node/patch area that exhibits\nthe least possible edge effect) for all patches is observed to decline\nby over 60% when an edge depth distance of 1 km is considered.\n\n| Edge depth distance (m) | Core Area (%) |\n|-------------------------|:-------------:|\n| 100                     |    65.76%     |\n| 500                     |    12.86%     |\n| 1000                    |     3.63%     |\n\n### Centrality measures\n\nIn this example, we continue to use the 404 remaining habitat fragments\nto estimate centrality indices using the `MK_RMCentrality()` function.\n\n```{r }\ncentrality_test \u003c- MK_RMCentrality(nodes = habitat_nodes,\n                                 distance = list(type = \"centroid\"),\n                                 distance_thresholds = 10000,\n                                 probability = 0.5,\n                                 write = NULL)\nhead(centrality_test)\n```\n\nExamples:\n\n![](images/example_Centrality.png)\n\n```{r eval = FALSE, echo=FALSE, out.width = \"100%\"}\ncluster.randomwalk \u003c- tm_shape(centrality_test) + \n  tm_fill(\"memb.rw\", \n          fill.scale = tm_scale_discrete(ticks =  1:length(unique(centrality_test$memb.rw)), \n                                         values = RColorBrewer::brewer.pal(length(unique(centrality_test$memb.rw)), \"PuOr\"))) + \n  tm_shape(TMVS) + tm_borders(lwd = 2)+  \n  tm_title(\"Random Walk Community Detection\", position = c(\"center\", \"top\"))+\n  tm_layout(legend.width = 8.5, legend.height = 10,\n            legend.position = c(0.01, 0.3)) \n\nBWC \u003c- tm_shape(centrality_test) + \n  tm_fill(\"BWC\", \n          fill.scale = tm_scale(breaks = classIntervals(centrality_test$BWC, 9, \"jenks\")[[2]], \n                                values = RColorBrewer::brewer.pal(9, \"PuOr\"))) + \n  tm_shape(TMVS) + tm_borders(lwd = 2)+ \n  tm_title(\"Betweenness centrality\", position = c(\"center\", \"top\"))+\n  tm_layout(legend.width = 8.5, legend.height = 10,\n            legend.position = c(0.01, 0.3))\n  \ntmap_arrange(cluster.randomwalk, BWC, ncol = 2)\n```\n\n**Moreover, you can change distance using the distance\n(**\u003ccode\u003e**?distancefile**\u003c/code\u003e**) argument:**\n\n**Euclidean distances:**\n\n-   distance = list(type= \"centroid\")\n-   distance = list(type= \"edge\")\n\n**Least cost distances:**\n\n-   distance = list(type= \"least-cost\", resistance = resistance raster)\n-   distance = list(type= \"commute-time\", resistance = resistance\n    raster)\n\n### Probability of connectivity (PC) and fractions (Intra, Flux and Connector) {#probability of connectivity (PC) and fractions (Intra, Flux and Connector)}\n\nIn this example, the `MK_dPCIIC()` function was applied to estimate the\nconnectivity of the 404 habitat fragments. In addition, we used a raster\nof dispersion resistance in the landscape that was estimated at a\n100-meter resolution using a spatial human footprint index, land use\nintensity, time of human landscape intervention, biophysical\nvulnerability, fragmentation, and habitat loss (Correa Ayram et al.,\n2017). The raster was aggregated by a factor of 5 to change its original\nresolution from 100m to 500m. To represent different dispersal\ncapacities of multiple species we considered the following median\n(associated to a probability of 0.5) distance thresholds: 250, 1500,\n3000, and 10,000 meters. These four distances group the 40 species\naccording to their dispersal distance requirements.\n\n```{r message=FALSE, warning=FALSE}\n#Habitat nodes\ndata(\"habitat_nodes\", package = \"Makurhini\")\nnrow(habitat_nodes)\n\n#Study area\ndata(\"TMVS\", package = \"Makurhini\")\n\n#Resistance\ndata(\"resistance_matrix\", package = \"Makurhini\")\n\n```\n\n```{r eval = FALSE, message=FALSE, warning=FALSE, out.width = \"100%\"}\nraster_map \u003c- as(resistance_matrix, \"SpatialPixelsDataFrame\")\nraster_map \u003c- as.data.frame(raster_map)\ncolnames(raster_map) \u003c- c(\"value\", \"x\", \"y\")\nggplot() +  \n  geom_tile(data = raster_map, aes(x = x, y = y, fill = value), alpha = 0.8) + \n  geom_sf(data = TMVS, aes(color = \"Study area\"), fill = NA, color = \"black\") +\n  geom_sf(data = habitat_nodes, aes(color = \"Habitat nodes\"), fill = \"forestgreen\", linewidth = 0.5) +\n  scale_fill_gradientn(colors = c(\"#000004FF\", \"#1B0C42FF\", \"#4B0C6BFF\", \"#781C6DFF\",\n                                  \"#A52C60FF\", \"#CF4446FF\", \"#ED6925FF\", \"#FB9A06FF\",\n                                  \"#F7D03CFF\", \"#FCFFA4FF\"))+\n  scale_color_manual(name = \"\", values = \"black\")+\n  theme_minimal() +\n  theme(axis.title.x = element_blank(),\n        axis.title.y = element_blank())\n```\n\n![](images/example_patches-02.png)\n\n```{r eval=FALSE, message=FALSE, warning=FALSE}\nPC_example \u003c- MK_dPCIIC(nodes = habitat_nodes,\n                        attribute = NULL,\n                        distance = list(type = \"least-cost\",\n                                        resistance = resistance_matrix),\n                        parallel = NULL,\n                        metric = \"PC\",\n                        probability = 0.5,\n                        distance_thresholds = c(250, 1500, 3000, 10000))\n```\n\n```{r eval=TRUE, message=FALSE, warning=FALSE, echo=FALSE}\nPC_example \u003c- readRDS(\"G:/Mi unidad/Makurhini_package/TEST_Folder/PC_example_2.rds\")\n```\n\nWe obtain a `list` object where each element is a result for each\ndistance threshold.\n\n```{r eval=TRUE, message=FALSE, warning=FALSE}\nclass(PC_example)\n\nnames(PC_example)\n\nhead(PC_example$d10000)\n```\n\nEach element of the list is a vector type object that can be exported\nusing the sf functions and in its vector formats (e.g., shp, gpkg) using\nthe sf package (Pebesma et al., 2024), for example:\n\n```{r eval=FALSE, message=FALSE, warning=FALSE}\nwrite_sf(PC_example$d10000, “.../dPC_d0000.shp”)\n```\n\nWe can use, for example, ggplot2 to map the results:\n\n```{r message=FALSE, warning=FALSE, out.width = \"90%\"}\nlibrary(classInt)\nlibrary(dplyr)\nlibrary(ggplot2)\n\nPC \u003c- PC_example$d10000 #Result 10 km\n\n# Calcular los intervalos de Jenks para strength\nbreaks \u003c- classInt::classIntervals(PC$dPC, n = 9, style = \"jenks\")\n\n# Crear una nueva variable categórica con los intervalos\nPC \u003c- PC %\u003e%\n  mutate(dPC_q = cut(dPC,\n                          breaks = breaks$brks,\n                          include.lowest = TRUE,\n                          dig.lab = 5))  \n\n# Graficar en ggplot2 usando las clases Jenks\nggplot() +  \n  geom_sf(data = TMVS, color = \"black\") +\n  geom_sf(data = PC, aes(fill = dPC_q), color = \"black\", size = 0.1) +\n  scale_fill_brewer(palette = \"RdYlGn\", direction = 1, name = \"dPC (jenks)\") +\n  theme_minimal() +\n  labs(\n    title = \"dPC Least-cost distance\",\n    fill = \"dPC\"\n  ) +\n  theme(\n    legend.position = \"right\",\n    plot.title = element_text(hjust = 0.5)\n  )\n\n```\n\n\n### Focal probability of connectivity (*PC~f~*)\n\nThe function `MK_focal_nodes()` enables the calculation of the focal\nIntegral Index of Connectivity (IICf) or the focal Probability of\nConnectivity (PCf​) under one or more distance thresholds. Furthermore,\nthis function estimates the composite connectivity index (CCIf​; for\nfurther details, please see Latorre-Cárdenas et al., 2023). In this\nexample, we apply the `MK_focal_nodes()` to the 404 habitat patches.\n\n```{r eval=FALSE}\nfocal_example \u003c- MK_Focal_nodes(nodes = habitat_nodes,\n                       id = \"Id\",\n                       attribute = NULL,\n                       raster_attribute = NULL,\n                       fun_attribute = NULL,\n                       distance = list(type = \"least-cost\",\n                                       resistance = resistance_matrix),\n                       metric = \"PC\",\n                       probability = 0.5,\n                       parallel = 4,\n                       distance_thresholds = 10000,\n                       search_buffer = 20000,\n                       intern = FALSE)\nhead(focal_example)\n```\n\n```{r echo=FALSE, eval=TRUE}\nfocal_example \u003c- readRDS(\"G:/Mi unidad/Makurhini_package/TEST_Folder/PCfocal.rds\")\n\nhead(focal_example)\n```\n\n```{r message=FALSE, warning=FALSE, out.width = \"90%\"}\n# Calcular los intervalos de Jenks para strength\nbreaks \u003c- classInt::classIntervals(focal_example$IComp, n = 9, style = \"jenks\")\n\n# Crear una nueva variable categórica con los intervalos\nfocal_example \u003c- focal_example %\u003e%\n  mutate(IComp_q = cut(IComp,\n                     breaks = breaks$brks,\n                     include.lowest = TRUE,\n                     dig.lab = 5))  \n\n# Graficar en ggplot2 usando las clases Jenks\nggplot() +  \n  geom_sf(data = TMVS, color = \"black\") +\n  geom_sf(data = focal_example, aes(fill = IComp_q), color = \"black\", size = 0.1) +\n  scale_fill_brewer(palette = \"RdYlGn\", direction = 1, name = \"IComp (jenks)\") +\n  theme_minimal() +\n  labs(\n    title = \"Composite connectivity index (IComp)\",\n    fill = \"IComp\"\n  ) +\n  theme(\n    legend.position = \"right\",\n    plot.title = element_text(hjust = 0.5)\n  )\n\n```\n\n### Equivalent Connectivity Area (ECA) {#equivalent-connectivity-area-eca}\n\nExample in the Biosphere Reserve Mariposa Monarca, Mexico, with\nold-growth vegetation fragments of four times (?list_forest_patches).\n\n```{r eval=TRUE}\ndata(\"list_forest_patches\", package = \"Makurhini\")\ndata(\"study_area\", package = \"Makurhini\")\nclass(list_forest_patches)\n\nMax_attribute \u003c- unit_convert(st_area(study_area), \"m2\", \"ha\")\n```\n\n```{r eval=TRUE, message=FALSE, warning=FALSE}\ndECA_test \u003c- MK_dECA(nodes= list_forest_patches, attribute = NULL, area_unit = \"ha\",\n                  distance = list(type= \"centroid\"), metric = \"PC\",\n                  probability = 0.05, distance_thresholds = 5000,\n                  LA = Max_attribute, plot= c(\"1993\", \"2003\", \"2007\", \"2011\"), intern = FALSE)\n```\n\nECA table:\n\n![](man/figures/table_eca2.PNG){width=\"504\"}\n\nAnother way to analyze the ECA (and ProtConn indicator) is by using the\n*'MK_Connect_grid()'* that estimates the index values on a grid. An\nexample of its application is the following, on the Andean-Amazon\nPiedmont. The analysis was performed using a grid of hexagons each with\nan area of 10,000 ha and a forest/non-forest map to measure changes in\nAndean-Amazon connectivity.\n\n![](man/figures/grid_example.png)\n\n### Protected Connected Land (ProtConn) {#protected-connected-land-protconn}\n\nIn this example, we assess the connectivity of Colombia's protected\nareas network in 33 ecoregions of great importance to the country using\nthe Protected Connected Indicator (ProtConn). Particularly, we have\n1,530 polygons of protected areas. The spatial information utilized in\nthis example is derived from the connectivity assessment study of\nprotected areas in the Andean Amazon region, as conducted by Castillo et\nal., (2020). In order to estimate the ProtConn index, we employ the\n`MK_ProtConn()` and `MK_ProtConn_mult()` functions. In this example, we\nwill utilize an organism median dispersal distance threshold of 10 km, a\nconnection probability pij = 0.5, and a transboundary PA search radius\nof 50 km (for further details, please refer to Castillo et al., 2020;\nSaura et al., 2017). We used Euclidean distances, particularly the\ndistances between edges to establish the connections between nodes\n(PAs).\n\n```{r echo=TRUE, eval=TRUE, message=FALSE, warning=FALSE}\n#Protected areas\nload(system.file(\"extdata\", \"Protected_areas.rda\",\n                 package = \"Makurhini\", mustWork = TRUE))\nnrow(Protected_areas)\n\n```\n\n```{r message=FALSE, warning=FALSE}\n#Ecoregions\ndata(\"Ecoregions\", package = \"Makurhini\")\nnrow(Ecoregions)\n```\n\n```{r warning=FALSE, message=FALSE, echo=FALSE, out.width = \"90%\"}\nmask_ecoregions \u003c- ms_dissolve(Ecoregions)\nPAs_national \u003c- ms_clip(Protected_areas, mask_ecoregions)\nPAs_transnational \u003c- ms_erase(Protected_areas, mask_ecoregions)\nPAs_transnational$Type \u003c- \"PAs in neighboring countries\"\nPAs_subnational \u003c- PAs_national[PAs_national$ESCALA_2 == \"Subnacional\",]\nPAs_subnational$Type \u003c- \"Subnational PAs\"\nPAs_national \u003c- PAs_national[PAs_national$ESCALA_2 == \"Nacional\",]\nPAs_national$Type \u003c- \"National PAs\"\nPAs \u003c- rbind(PAs_national, PAs_subnational, PAs_transnational)\nPAs$Type \u003c- factor(PAs$Type, levels = c(\"National PAs\", \"Subnational PAs\", \"PAs in neighboring countries\"))\n\nggplot() +\n  geom_sf(data = Ecoregions, aes(fill = \"Ecoregions\"), color = \"black\") +\n  geom_sf(data = PAs, aes(fill=Type), color = NA) +\n  scale_fill_manual(name = \"Type\", values = c(\"#1DAB80\", \"#FF00C5\", \"#E06936\", \"#8D8BBE\"))+\n  theme_minimal() \n```\n\n#### MK_ProtConn()\n\nThis function calculates the Protected Connected indicator (ProtConn)\nfor a region, its fractions and the importance (contribution) of each\nprotected area to maintain connectivity in the region under one or more\ndistance thresholds.\n\n```{r eval=TRUE, message=FALSE, warning=FALSE}\n#Select first ecoregion\nEcoregion_1 \u003c- Ecoregions[1,]\n\n#keep = 0.6 simplify the geometry and reduce the number of vertices\nProtConn_1 \u003c- MK_ProtConn(nodes = Protected_areas, region = Ecoregion_1, \n                          area_unit = \"ha\", \n                          distance = list(type= \"edge\", keep = 0.6),\n                          distance_thresholds = 10000, probability = 0.5,\n                          transboundary = 50000, plot = TRUE, \n                          delta = TRUE, intern = FALSE)\n\n```\n\nA dynamic table is generated, displaying the ProtConn values and their\nfractions. Additionally, a graph is produced, illustrating the ProtConn\nvalues and comparing them with the percentage of protected and connected\narea recommended for a region in the Aichi and Kumming-Montreal targets.\n\n```{r}\nclass(ProtConn_1)\nnames(ProtConn_1)\n```\n\n```{r eval= TRUE, message=FALSE, warning=FALSE}\nProtConn_1$`Protected Connected (Viewer Panel)`\n```\n\n```{r eval= FALSE, message=FALSE, warning=FALSE, out.width = \"100%\"}\nProtConn_1$`ProtConn Plot`\n```\n\n![](images/example_protconnplot2.png)\n\nProtConn delta or the higher contribution to ProtConn value in the\necoregion (grey polygon):\n\n```{r message=FALSE, warning=FALSE, out.width = \"90%\"}\nggplot()+\n  geom_sf(data = Ecoregion_1, col = \"black\")+\n  geom_sf(data = ProtConn_1$ProtConn_Delta, \n          aes(fill = cut(dProtConn, breaks = classIntervals(ProtConn_1$ProtConn_Delta$dProtConn, 7, \"jenks\")[[2]])), color = NA)+\n  scale_fill_brewer(type = \"qual\",\n                    palette = \"YlOrRd\",\n                    name = \"dProtConn PAs\",\n                    na.translate = FALSE)+\n  theme_minimal() +\n  theme(\n    legend.position.inside = c(0.1,0.21),\n    legend.key.height = unit(0.4, \"cm\"),\n    legend.key.width = unit(0.5, \"cm\")\n  )\n\n```\n\n#### MK_ProtConnMult()\n\nIn order to facilitate the estimation of the ProtConn index for a\nvariety of geographical regions, the MK_ProtConnMult function has been\nincorporated into Makurhini, which enables the estimation of the\nProtConn indicator and fractions for different regions.\n\n```{r eval=FALSE}\nProtConn_2 \u003c- MK_ProtConnMult(nodes = Protected_areas, \n                              region = Ecoregions,\n                              area_unit = \"ha\",\n                              distance = list(type= \"edge\"),\n                              distance_thresholds = 10000,\n                              probability = 0.5, transboundary = 50000,\n                              plot = TRUE, parallel = 4)\n```\n\n```{r echo=FALSE}\nProtConn_2 \u003c- readRDS(\"G:/Mi unidad/Makurhini_package/TEST_Folder/ProtConn_1b.rds\")\n```\n\nA dynamic table and vector (sf class) are generated, displaying the\nProtConn values and their fractions. Additionally, a graph is produced,\nillustrating the ProtConn values and comparing them with the percentage\nof protected and connected area recommended for a region in the Aichi\nand Kumming-Montreal targets.\n\n```{r}\nclass(ProtConn_2)\nnames(ProtConn_2)\n```\n\nTable:\n\n```{r eval=TRUE}\nProtConn_2$ProtConn_10000$ProtConn_overall10000\n```\n\nPlot showing the mean and standard deviation values:\n\n```{r eval=FALSE}\nProtConn_2$ProtConn_10000$`ProtConn Plot`\n```\n\n![](images/example_protconnplot1.png)\n\nVector file of class sf:\n\n```{r}\nhead(ProtConn_2$ProtConn_10000$ProtConn_10000)\n```\n\nVisualize using ggplot2:\n\n```{r eval=TRUE, message=FALSE, warning=FALSE, echo= FALSE}\ninterv \u003c- c(0.0701, 1.9375, 4.2690, 6.6786, 10.7244, 17.8158, 25.6303, 41.8570, 45.4735, 97.7425)\n```\n\n```{r eval=FALSE, message=FALSE, warning=FALSE, echo=TRUE}\n#We can use some package to get intervals for example classInt R Packge:\n#library(classInt)\n#interv \u003c- classIntervals(ProtConn_2$ProtConn_10000$ProtConn_10000$ProtConn, 9, \"jenks\")[[2]]\n```\n\n```{r message=FALSE, warning=FALSE, out.width = \"90%\"}\nggplot()+\n  geom_sf(data = Ecoregions)+\n  geom_sf(data = ProtConn_2$ProtConn_10000$ProtConn_10000, \n          aes(fill = cut(ProtConn, breaks = interv)), color = NA)+\n  scale_fill_brewer(type = \"qual\",\n                    palette = \"RdYlGn\",\n                    name = \"ProtConn\",\n                    na.translate = FALSE)+\n  theme_minimal() +\n  theme(\n    legend.position.inside = c(0.1,0.21),\n    legend.key.height = unit(0.4, \"cm\"),\n    legend.key.width = unit(0.5, \"cm\")\n  )\n```\n","funding_links":[],"readme_doi_urls":["https://doi.org/10.21203/rs.3.rs-6398746/v1","https://doi.org/10.1111/1365-2664.12179","https://doi.org/10.1111/ele.13333","https://doi.org/10.3390/land12030631","https://doi.org/10.1007/s10980-006-0013-z","https://doi.org/10.1016/j.landurbplan.2007.03.005","https://doi.org/10.1111/j.1600-0587.2009.05760.x","https://doi.org/10.1016/j.ecolind.2010.06.011","http://dx.doi.org/10.1016/j.ecolind.2016.12.047","https://doi.org/10.1016/j.biocon.2017.12.020"],"works":{},"citation_counts":{},"total_citations":0,"keywords_from_contributors":[],"project_url":"https://ost.ecosyste.ms/api/v1/projects/351801","html_url":"https://ost.ecosyste.ms/projects/351801"}