conflict_prefer: Persistently prefer one function over another

View source: R/prefer.R

conflict_preferR Documentation

Persistently prefer one function over another


conflict_prefer() allows you to declare "winners" of conflicts. You can either declare a specific pairing (i.e. dplyr::filter() beats base::filter()), or an overall winner (i.e. dplyr::filter() beats all comers). As of conflicted 1.2.0, in most case you should use conflicts_prefer() instead as it's both faster and easier to use.

Use conflicted_prefer_all() to prefer all functions in a package, or conflicted_prefer_matching() to prefer functions that match a regular expression.


conflict_prefer(name, winner, losers = NULL, quiet = FALSE)

conflict_prefer_matching(pattern, winner, losers = NULL, quiet = FALSE)

conflict_prefer_all(winner, losers = NULL, quiet = FALSE)



Name of function.


Name of package that should win the conflict.


Optional vector of packages that should lose the conflict. If omitted, winner will beat all comers.


If TRUE, all output will be suppressed


Regular expression used to select objects from the winner package.


# Prefer over all other packages
conflict_prefer("filter", "dplyr")

# Prefer over specified package or packages
conflict_prefer("filter", "dplyr", "base")
conflict_prefer("filter", "dplyr", c("base", "filtration"))

# Prefer many functions that match a pattern
## Not run: 
# Prefer col_* from vroom
conflict_prefer_matching("^col_", "vroom")

## End(Not run)
# Or all functions from a package:
## Not run: 
# Prefer all tidylog functions over dtplyr functions
conflict_prefer_all("tidylog", "dtplyr")

## End(Not run)

conflicted documentation built on Feb. 16, 2023, 6:05 p.m.