When dplyr::mutate is used on a grouped data.table, the grouping is subsequently lost. This behavior does not occur for data.frame. Is this a bug? I am using dplyr_0.4.1 and data.table_1.9.4.
require(data.table)
require(dplyr)
by_cyl_df <- group_by( mtcars, cyl ) %>%
dplyr::mutate( . ,
maxmpg = max( mpg )
)
groups( by_cyl_df )
[[1]] cyl
by_cyl_dt <- group_by( as.data.table(mtcars), cyl ) %>%
dplyr::mutate( . ,
maxmpg = max( mpg )
)
groups( by_cyl_dt )
NULL