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

purrr:contains and dplyr::contains is likely to cause confusion #217

Closed
sebastiansauer opened this issue Jul 11, 2016 · 8 comments
Closed

purrr:contains and dplyr::contains is likely to cause confusion #217

sebastiansauer opened this issue Jul 11, 2016 · 8 comments
Labels

Comments

@sebastiansauer
Copy link

@sebastiansauer sebastiansauer commented Jul 11, 2016

Both purrr and dplyr have a contains() function, but with different syntax.

For example, if I load dplyr first, and purr afterwards, it will bite me:

   library(dplyr)
   library(purrr)
   data(tips, package = "reshape2")
   tips %>% select(contains("total"))
   ## Error in .p(.x[[i]], ...) : argument ".y" is missing, with no default

May it would be helpful to disambiguate the two functions?

@hadley
Copy link
Member

@hadley hadley commented Sep 22, 2016

@lionel- any thoughts on a better name? We might need to consider more prefixes for purrr functions since it's going to be loaded increasingly commonly

@lionel-
Copy link
Member

@lionel- lionel- commented Sep 22, 2016

we could prefix with vec_ secondary functions that operate on vectors, generic and atomic? But then what would be the prefix for atomic vectors functions?

@hadley
Copy link
Member

@hadley hadley commented Sep 22, 2016

atm_? But if you think of contains() as a function that operates on vectors, maybe it should go in vctrs? I think we'll need to figure out what goes where.

@lionel-
Copy link
Member

@lionel- lionel- commented Sep 22, 2016

this makes me think that the tidyverse is starting to look like Emacs lisp functions ;) Elisp doesn't have namespaces so all function names have to be prefixed.

maybe it should go in vctrs?

I'm not sure, this is a wrapper around some(). We'll also have to figure out what should be the dependency graph of those packages.

atm_?

ah nice, I was stuck with ato_ for some reason.

@DataStrategist
Copy link

@DataStrategist DataStrategist commented Oct 5, 2016

Or just change one of the verbs to has()?

@jtr13
Copy link

@jtr13 jtr13 commented Feb 25, 2017

Yes, confusion caused.

> select(x100, contains("P"))
Error in .p(.x[[i]], ...) : argument ".y" is missing, with no default
@hadley
Copy link
Member

@hadley hadley commented Mar 5, 2017

And similarly for order_by()

@hadley hadley closed this in 7dc96a8 Mar 8, 2017
sebastian-c pushed a commit to UNFAOstatistics/pocketbook_database that referenced this issue Mar 28, 2017
sebastian-c pushed a commit to UNFAOstatistics/pocketbook_database that referenced this issue Mar 28, 2017
@kleinschmidt
Copy link

@kleinschmidt kleinschmidt commented Sep 28, 2017

Why did sort_by need to be removed as well, and what's the recommended replacement (other than "use tibbles")?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants