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

Should spread have digits argument? #208

Closed
hadley opened this issue Jun 13, 2016 · 1 comment
Closed

Should spread have digits argument? #208

hadley opened this issue Jun 13, 2016 · 1 comment
Labels
feature a feature request or enhancement pivoting ♻️ pivot rectangular data to different "shapes"

Comments

@hadley
Copy link
Member

hadley commented Jun 13, 2016

To avoid mutate here:

library(tidyr)
library(dplyr)

prob <- seq(0, 1, length = 10)
mtcars %>%
  group_by(cyl) %>%
  summarise(q = list(quantile(mpg, prob)), p = list(prob)) %>%
  unnest() %>%
  mutate(p = format(p, digits = 2)) %>%
  spread(p, q, sep = "_")
@hadley hadley added the feature a feature request or enhancement label Jun 23, 2017
@hadley hadley added rectangling 🗄️ converting deeply nested lists into tidy data frames pivoting ♻️ pivot rectangular data to different "shapes" and removed rectangling 🗄️ converting deeply nested lists into tidy data frames labels Nov 16, 2017
@hadley
Copy link
Member Author

hadley commented Mar 3, 2019

Now handled via pivot spec: if you want greater control over column names, you can generate the col_names yourself

@hadley hadley closed this as completed Mar 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement pivoting ♻️ pivot rectangular data to different "shapes"
Projects
None yet
Development

No branches or pull requests

1 participant