converted from Sweave syntax to pure knitr