EuracBiomedicalResearch / tidyfr

R interface to retrieve CHRIS data.
https://euracbiomedicalresearch.github.io/tidyfr/
1 stars 1 forks source link

`group` method conflicts #2

Open filosi opened 1 year ago

filosi commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

I can give it a try and let you know!

jorainer commented 1 year ago

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

filosi commented 1 year ago

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 commented 1 year ago

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.