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

add nest param to rsplit to replicate the functionality of tidyr::nest #567

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

arthurgailes
Copy link
Contributor

No description provided.

@arthurgailes
Copy link
Contributor Author

Could probably do more here, e.g. allowing for a rename of $data and unnest, but stopping here in case this is out-of-scope.

@SebKrantz
Copy link
Owner

Thanks. Let me thing about it for a bit. I agree that this is the most parsimonious way of adding this, but fundamentally rsplit() is a recursive function and not designed to output a data.frame. I think a better way to go would be properly implementing nest() and unnest(). So far I've seen this as unnecessary because you can simply do qTBL(mtcars) |> gby(cyl, vs, am) |> smr(list(data = list(.data))), but I can think about it.

@arthurgailes
Copy link
Contributor Author

Sure thing. Perhaps something like:

fnest <- function(data, ..., .key = "data") {
  smr(
    gby(data, ...),
    setNames(list("col" = list(.data)), .key)
  )
}

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

Successfully merging this pull request may close these issues.

None yet

2 participants