Knitr version of ddply