ropensci / taxa

taxonomic classes for R
https://docs.ropensci.org/taxa
Other
48 stars 12 forks source link

Use `rlang` instead of `lazyeval` for NSE #62

Closed zachary-foster closed 7 years ago

zachary-foster commented 7 years ago

After running into some mysterious bugs, I made a reproducibility example and asked people on the ropensci slack to look at it. Jim Hester figured out the cause:

@zachary-foster It is because devtools::test() runs devtools::load_all() which puts all function objects in the evaluation environment. You get the same behavior if you run library(bugtest);func_a <- bugtest::func_a; func_b(func_a). But the real solution is to switch to using the newer iteration of lazy evaluation found in rlang instead, e.g. use rlang::eval_tidy(rlang::enquo(x), data = my_data) instead of lazyeval::lazy_eval(lazyeval::lazy(x), data = my_data). The rlang version works in all cases for this example and is what everything in the tidyverse will be migrated to.