我希望下面的代码
library(dplyr)
library(broom)
d <- data.frame(a = 1:3, b = 8:10)
d %>% inflate(x = c("apple", "orange"), y = c("car", "boat"))
给我一个 12 x 4 的数据框,如下所示:
## 1 apple boat 1 8
## 2 apple boat 2 9
## 3 apple boat 3 10
## 4 apple car 1 8
## 5 apple car 2 9
## 6 apple car 3 10
## 7 orange boat 1 8
## 8 orange boat 2 9
## 9 orange boat 3 10
## 10 orange car 1 8
## 11 orange car 2 9
## 12 orange car 3 10
但它给了我这个:
# A tibble: 4 x 2
# Groups: x, y [4]
x y
<chr> <chr>
1 apple boat
2 apple car
3 orange boat
4 orange car
似乎d
被忽略了。这是怎么回事?