Consider this grouped_df:
d <- data_frame(
g = rep(LETTERS[1:2], each = 3),
x = c("a", "c", "a", "b", "c", "d") ,
y = c(1, 2, 1, 2, 1, 2)
) %>% group_by(g) %>% print
Source: local data frame [6 x 3]
Groups: g [2]
g x y
(chr) (chr) (dbl)
1 A a 1
2 A c 2
3 A a 1
4 B b 2
5 B c 1
6 B d 2
complete() respects the grouping when creating new rows, but the result is no longer a grouped data-frame. Shouldn't complete() preserving the grouping?
d %>% complete(x, y)
Source: local data frame [11 x 3]
g x y
(chr) (chr) (dbl)
1 A a 1
2 A a 1
3 A a 2
4 A c 1
5 A c 2
6 B b 1
7 B b 2
8 B c 1
9 B c 2
10 B d 1
11 B d 2
d %>% complete(x, y) %>% is.grouped_df()
[1] FALSE
Consider this
grouped_df:complete()respects the grouping when creating new rows, but the result is no longer a grouped data-frame. Shouldn'tcomplete()preserving the grouping?d %>% complete(x, y)d %>% complete(x, y) %>% is.grouped_df()[1] FALSE