plyr::ddply
updated example and commented out coef cos preventing check