Skip to content

Expand and grouping variables #122

Closed
@danielsjf

Description

@danielsjf

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions