Closed
Description
When I create a group_by object based on a column or set of columns, then I perform cbind with that group_by object, the result is a matrix of lists rather than the expected object (either a tbl_df or a data.frame):
> x <- tbl_df(data=data.frame(a=rep(1:3, each=3), b=1:9, c=10:18))
> cbind(x[,"a", drop=FALSE], x[,c("b", "c"), drop=FALSE])
a b c
1 1 1 10
2 1 2 11
3 1 3 12
4 2 4 13
5 2 5 14
6 2 6 15
7 3 7 16
8 3 8 17
9 3 9 18
>
> x <- group_by(x, a)
> cbind(x[,"a", drop=FALSE], x[,c("b", "c"), drop=FALSE])
[,1] [,2]
b Integer,9 Integer,9
c Integer,9 Integer,9
> class(cbind(x[,"a", drop=FALSE], x[,c("b", "c"), drop=FALSE]))
[1] "matrix"
>