Updated dplyr code based on Hadley's Twitter suggestion