{"id":14068377,"url":"https://github.com/r-lib/conflicted","last_synced_at":"2025-04-08T09:09:20.378Z","repository":{"id":38956464,"uuid":"134195690","full_name":"r-lib/conflicted","owner":"r-lib","description":"An alternative conflict resolution strategy for R","archived":false,"fork":false,"pushed_at":"2024-02-22T21:02:28.000Z","size":4671,"stargazers_count":249,"open_issues_count":10,"forks_count":14,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-01T07:51:19.520Z","etag":null,"topics":["conflicts","r"],"latest_commit_sha":null,"homepage":"https://conflicted.r-lib.org/","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/r-lib.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","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}},"created_at":"2018-05-20T23:37:42.000Z","updated_at":"2025-03-22T08:14:31.000Z","dependencies_parsed_at":"2023-02-16T10:25:26.103Z","dependency_job_id":"97889ace-2b70-4100-b41d-d43f1068c50e","html_url":"https://github.com/r-lib/conflicted","commit_stats":{"total_commits":211,"total_committers":9,"mean_commits":"23.444444444444443","dds":0.09478672985781988,"last_synced_commit":"9fabdc7cd2251f8e59db4c15330edea3b8e0fd35"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fconflicted","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fconflicted/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fconflicted/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fconflicted/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r-lib","download_url":"https://codeload.github.com/r-lib/conflicted/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247809964,"owners_count":20999816,"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":["conflicts","r"],"created_at":"2024-08-13T07:06:07.907Z","updated_at":"2025-04-08T09:09:20.352Z","avatar_url":"https://github.com/r-lib.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, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"README-\"\n)\nset.seed(1014)\n```\n\n# conflicted\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/r-lib/conflicted/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/conflicted/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/r-lib/conflicted/branch/main/graph/badge.svg)](https://app.codecov.io/gh/r-lib/conflicted?branch=main)\n\u003c!-- badges: end --\u003e\n\nThe goal of conflicted is to provide an alternative conflict resolution strategy. R's default conflict resolution system gives precedence to the most recently loaded package. This can make it hard to detect conflicts, particularly when introduced by an update to an existing package. conflicted takes a different approach, making every conflict an error and forcing you to choose which function to use.\n\nThanks to [\\@krlmlr](https://github.com/krlmlr) for this neat idea! This code was previously part of the experimental [strict](https://github.com/hadley/strict) package, but I decided improved conflict resolution is useful by itself and worth its own package.\n\n## Installation\n\n```{r, eval = FALSE}\n# install.packages(\"pak\")\npak::pak(\"r-lib/conflicted\")\n```\n\n## Usage\n\nTo use conflicted, all you need to do is load it:\n\n```{r, error = TRUE}\nlibrary(conflicted)\nlibrary(dplyr)\n\nfilter(mtcars, cyl == 8)\n```\n\nAs suggested, you can either namespace individual calls:\n\n```{r}\ndplyr::filter(mtcars, am \u0026 cyl == 8)\n```\n\nOr declare a session-wide preference:\n\n```{r}\nconflicts_prefer(dplyr::filter())\nfilter(mtcars, am \u0026 cyl == 8)\n```\n\nI recommend declaring preferences directly underneath the corresponding library call:\n\n```{r, eval = FALSE}\nlibrary(dplyr)\nconflicts_prefer(dplyr::filter)\n```\n\nYou can ask conflicted to report any conflicts in the current session:\n\n```{r}\nconflict_scout()\n```\n\nFunctions surrounded by `[]` have been chosen using one of the built-in rules. Here `filter()` has been selected because of the preference declared above; the set operations have been selected because they follow the superset principle and extend the API of the base equivalents.\n\n### How it works\n\nLoading conflicted creates a new \"conflicted\" environment that is attached just after the global environment. This environment contains an active binding for any object that is exported by multiple packages; the active binding will throw an error message describing how to disambiguate the name. The conflicted environment also contains bindings for `library()` and `require()` that suppress conflict reporting and update the conflicted environment with any new conflicts.\n\n## Alternative approaches\n\nIt is worth comparing conflicted to [box](https://github.com/klmr/box) and [import](https://github.com/rticulate/import). Both packages provide strict alternatives to `library()`, giving much finer control over what functions are added to the search path.\n\n```{r, eval = FALSE}\n# box expects you to either namespace all package functions or to load them explicitly\nbox::use(dplyr)\ndplyr$filter(mtcars, cyl == 8)\n# or:\nbox::use(dplyr[select, arrange, dplyr_filter = filter])\ndplyr_filter(mtcars, cyl == 8)\n\n# import expects you to explicitly load functions\nimport::from(dplyr, select, arrange, dplyr_filter = filter)\ndplyr_filter(mtcars, cyl == 8)\n```\n\nThese require more upfront work than conflicted, in return for greater precision and control.\n\nSince conflicted was created base R also improved its tools for managing search path conflicts. See [the blog post](https://developer.r-project.org/Blog/public/2019/03/19/managing-search-path-conflicts/) by Luke Tierney for details. The main difference is that base R requires up front conflict resolution of all functions when loading a package; conflicted only reports problems as you use conflicted functions.\n\n## Code of Conduct\n\nPlease note that the conflicted project is released with a [Contributor Code of Conduct](https://conflicted.r-lib.org/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-lib%2Fconflicted","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr-lib%2Fconflicted","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-lib%2Fconflicted/lists"}