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

Examples do not work - issue with pick #199

Open
SergejRuff opened this issue Sep 24, 2024 · 4 comments
Open

Examples do not work - issue with pick #199

SergejRuff opened this issue Sep 24, 2024 · 4 comments

Comments

@SergejRuff
Copy link

Examples where pick() is utilized do not work and return the following error:

Error in pick():
! Must only be used inside data-masking verbs like mutate(), filter(), and group_by().

Examples can be found in the position functions such as gggenomes::position_strand'.

@thackl
Copy link
Owner

thackl commented Sep 25, 2024

This looks like you are using dplyr::pick() here. dplyr recently introduced a new function with that name. You need to either load library(gggenomes) after library(tidyverse/dplyr), or explicitly call gggenomes::pick() to get the right function.

@thackl thackl changed the title Examples do not work Examples do not work - issue with pick Sep 25, 2024
@SergejRuff
Copy link
Author

Right, but is pick attached or loaded. If pick is included in the NAMESPACE of the function (@importfrom package pick) than that shouldnt happen, right? Is pick loaded into the enviroment?

@SergejRuff
Copy link
Author

I just checked and realized that there is a function called pick:

pick <- function(x, ...) {
. is it possible to rename it for future versions into a unique name that does not conflict with other pick functions (gggene_pick for example)?

@thackl
Copy link
Owner

thackl commented Sep 26, 2024

The somewhat mean thing here is that gggenomes' pick() function was actually there first (https://thackl.github.io/gggenomes/reference/pick.html). I had chosen pick() as function name for gggenomes in part because it had no overlap with other tidyverse functions. But now dplyr has added it's own pick function. I might rename pick, but generally speaking, I also don't want to rename existing functions anytime someone else releases a new function with the same name.

Regarding unique name, well it is easy to use the name in a unique fashion, just explicitly write gggenomes::pick() and dplyr::pick(), which isn't much different from something like gggenomes_pick().

And as a quick workaround you can of course always simply use your own function names, just put something like this in your code

pick_bins <- gggenomes::pick
pick_bins()

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

No branches or pull requests

2 participants