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

First attempt to adapt pivot_longer to sf #1151

Closed
wants to merge 1 commit into from
Closed

First attempt to adapt pivot_longer to sf #1151

wants to merge 1 commit into from

Conversation

lepennec
Copy link

As pivot_longer is not yet a s3_methods, the new function is only available under the name pivot_longer.sf...

as pivot_longer is not yet a s3_methods, the new function is only available under the name pivot_longer.sf
Copy link
Member

@edzer edzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it is a better idea to get confirmation from the authors that pivot_longer is never going to be a generic (and hear why), as opposed to e.g. gather, before we go along with suggesting users to write pivot_longer.sf(...).

#' @examples
#' library(tidyr)
#' nc %>% select(SID74, SID79) %>% gather("VAR", "SID", -geometry) %>% summary()
pivot_longer.sf <- function(data, cols, names_to = "name", names_prefix = NULL,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to replace all the parameters that you want to pass on untouched as ... , unless you want to change their default. This would spare you (and me) the work of documenting them, and keeping track of changes in upcoming tidyr versions.

@@ -405,6 +433,7 @@ register_all_s3_methods = function() {
register_s3_method("dplyr", "ungroup", "sf")
register_s3_method("tidyr", "gather", "sf")
register_s3_method("tidyr", "spread", "sf")
register_s3_method("tidyr", "pivot_longer", "sf")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if pivot_longer is not an s3 method, this shouldn't work.

@lepennec
Copy link
Author

lepennec commented Sep 15, 2019 via email

@etiennebr etiennebr added the wip work in progress label Nov 26, 2019
@edzer
Copy link
Member

edzer commented Jul 8, 2020

please re-PR when there is some progress in this area.

@edzer edzer closed this Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wip work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants