Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several functions (with prepending) won't work if you don't load dplyr #2297

Closed
johneverettkoo opened this issue Dec 7, 2016 · 6 comments
Closed
Assignees
Labels

Comments

@johneverettkoo
Copy link

@johneverettkoo johneverettkoo commented Dec 7, 2016

Because of namespace conflicts, I typically avoid library and instead prepend everything (e.g., either dplyr::mutate or dp <- loadNamespace('dplyr') and dp$mutate). If I don't want to prepend, I'll use import (e.g., import::from(magrittr, `%>%`)). Sometimes this doesn't work because of unaccounted dependencies and such, but most of the tidyverse packages seem to work perfectly with these. The two issues I've run into so far are dplyr::order_by and dplyr::data_frame. I noticed that dplyr::order_by work as expected if I first run import::from(dplyr, with_order) and dplyr::data_frame will work as expected if I first run import::from(tibble, as_tibble), but it would be nice if I could avoid that.

@johneverettkoo johneverettkoo changed the title Several functions won't work if you don't load dplyr Several functions (with prepending) won't work if you don't load dplyr Dec 7, 2016
@krlmlr
Copy link
Member

@krlmlr krlmlr commented Dec 8, 2016

Thanks. This makes sense, but could you please provide a reproducible example?

@johneverettkoo
Copy link
Author

@johneverettkoo johneverettkoo commented Dec 8, 2016

The example for order_by doesn't work:

> dplyr::order_by(10:1, cumsum(1:10))
Error in eval(expr, envir, enclos) : could not find function "with_order"

You have to first library(dplyr) (which can lead to namespace conflicts) or:

> import::from(dplyr, with_order)
> dplyr::order_by(10:1, cumsum(1:10))
 [1] 55 54 52 49 45 40 34 27 19 10

And I just tried dplyr::data_frame and that one seems to work as expected (maybe I updated something recently).

@krlmlr
Copy link
Member

@krlmlr krlmlr commented Dec 9, 2016

Thanks, confirmed. order_by() is performing nonstandard evaluation and currently expects with_order() to be accessible from the caller's environment.

@krlmlr
Copy link
Member

@krlmlr krlmlr commented Dec 15, 2016

Need to make it work with complex calls or throw an error, see #2293.

@johneverettkoo
Copy link
Author

@johneverettkoo johneverettkoo commented Dec 15, 2016

Thank you!

@hadley
Copy link
Member

@hadley hadley commented Feb 20, 2017

Adding @lionel- since this is NSE related

@hadley hadley added the nse label Feb 20, 2017
lionel- added a commit to lionel-/dplyr that referenced this issue Mar 22, 2017
lionel- added a commit to lionel-/dplyr that referenced this issue Mar 24, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jun 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants