Conflicts between rlang, purrr and lazyeval

I am working in a legacy codebase where someone has code like this at the start:

library(purrr)
library(rlang)
library(lazyeval)

I have used purrr before, but have never used rlang or lazyeval. I have heard of "Non-Standard Evaluation" before, and maybe used it once or twice, but am far from fluent with it.

My main question / concern is that these 3 packages seem to define many functions with the same name. So when the script runs you get a lot of "function x masks the same function in another package warning". It it easy to see this with the conflicted package:

library(rlang)
library(purrr)
library(lazyeval)

library(conflicted)
conflict_scout()

31 conflicts:
* `%@%`             : purrr, rlang
* `as_function`     : purrr, rlang
* `as_name`         : lazyeval, rlang
* `call_modify`     : lazyeval, rlang
* `call_standardise`: lazyeval, rlang
* `expr_label`      : lazyeval, rlang
* `expr_text`       : lazyeval, rlang
* `f_env`           : lazyeval, rlang
* `f_env<-`         : lazyeval, rlang
* `f_label`         : lazyeval, rlang
* `f_lhs`           : lazyeval, rlang
* `f_lhs<-`         : lazyeval, rlang
* `f_rhs`           : lazyeval, rlang
* `f_rhs<-`         : lazyeval, rlang
* `f_text`          : lazyeval, rlang
* `flatten`         : purrr, rlang
* `flatten_chr`     : purrr, rlang
* `flatten_dbl`     : purrr, rlang
* `flatten_int`     : purrr, rlang
* `flatten_lgl`     : purrr, rlang
* `flatten_raw`     : purrr, rlang
* `invoke`          : purrr, rlang
* `is_atomic`       : lazyeval, rlang
* `is_call`         : lazyeval, rlang
* `is_formula`      : lazyeval, rlang
* `is_lang`         : lazyeval, rlang
* `list_along`      : purrr, rlang
* `missing_arg`     : lazyeval, rlang
* `modify`          : purrr, rlang
* `prepend`         : purrr, rlang
* `splice`          : purrr, rlang

Can someone please tell me why there are so many conflicts between these packages? Was one of them intended to replace / supercede the others?

Thanks.

(Note: My actual situation is somewhat different than this. I am using a suite of in-house R packages that cumulatively Depend on each of these packages. But I think that the end result is the same.)

If you use/look at the more recent versions of rlang, many of the functions you see masked (e.g. prepend(), splice()), are now solely in purrr. Notably, the flatten functions are stable in purrr, and are "questioning" in rlang (see info on lifecycle below), and do have slightly different semantics:

lazyeval has been superseded by rlang. We're working on better communicating these changes to the user with deprecation messages using lifecycle.

rlang, which has undergone much development over the past few years has a lifecycle page of its own here:

One tool of note, if you want to use package::function()notation is prefixer, which helps you go through and add prefixes (as the name suggests) to your functions:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.