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

group method conflicts #2

Open
filosi opened this issue Feb 28, 2023 · 5 comments
Open

group method conflicts #2

filosi opened this issue Feb 28, 2023 · 5 comments

Comments

@filosi
Copy link
Collaborator

filosi commented Feb 28, 2023

The group method of the tidyfr package have a conflict with dplyr::groups() function.

Possible solutions could be:

  1. use the conflicted package https://www.tidyverse.org/blog/2018/06/conflicted/ load before any other libraries and then chose which method to use as default.
  2. Direct call to the method with tidyrfr::groups()
@jorainer
Copy link
Member

jorainer commented Mar 3, 2023

Thanks for reporting Michele @filosi - one maybe working solution would be to create a S4 method for the groups (instead of a simple function), add a method for DataModule and the method for ANY would simply forward to e.g. dplyr - do you want to give it a go Michele and make a pull request?

@filosi
Copy link
Collaborator Author

filosi commented Mar 7, 2023

I can give it a try and let you know!

@jorainer
Copy link
Member

jorainer commented Mar 8, 2023

Ah, and please either develop in your own branch or fork the repo and then do a PR to the main branch.

filosi added a commit to filosi/tidyfr that referenced this issue Mar 9, 2023
@filosi
Copy link
Collaborator Author

filosi commented Mar 9, 2023

I tried with the solution @jorainer proposed, but still the method is not dispatched correctly. I found a possible workaround. When loading dplyr packages it create an S3 groups, and even thought the S4 method is present, it's not dispatched correctly on the current class. I proposed a solution which add some "repeated" code exporting the same .groups function through S3 method dispatch.
Please check it out https://github.com/filosi/tidyfr/tree/feature/groups_conflict before make the pull request.

@jorainer
Copy link
Member

jorainer commented Mar 9, 2023

Had a quick look - and if that works I'm totally OK with it - can you please make the PR? then we can discuss there directly in the code.

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