replace plyr by dplyr 2