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

Expand and grouping variables #122

Closed
danielsjf opened this Issue Oct 9, 2015 · 0 comments

Comments

Projects
None yet
1 participant
@danielsjf

danielsjf commented Oct 9, 2015

It looks like expand, combined with some grouping variables gives some strange results:

> df <- data.frame(a=1:2,b=3:4,c=5:6)
> df %>% expand(a,b,c)
Source: local data frame [8 x 3]
      a     b     c
  (int) (int) (int)
1     1     3     5
2     1     3     6
3     1     4     5
4     1     4     6
5     2     3     5
6     2     3     6
7     2     4     5
8     2     4     6
> df %>% group_by(a,b) %>% expand(a,b,c)
Source: local data frame [8 x 7]
      b     a     a     b     a     b     c
  (int) (int) (int) (int) (int) (int) (int)
1     3     1     1     3     1     3     5
2     3     1     1     3     2     4     6
3     3     1     2     4     1     3     5
4     3     1     2     4     2     4     6
5     4     2     1     3     1     3     5
6     4     2     1     3     2     4     6
7     4     2     2     4     1     3     5
8     4     2     2     4     2     4     6

@hadley hadley closed this in 193f3a4 Dec 30, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment