While I was answering a question from a user last week, I saw a piece of code that, in my opinion, could be shortened. What it does is to set two chunk options, message and warning, to NA or FALSE according the version of the evaluate package.

setHook(packageEvent("knitr", "onLoad"), function(…) { message_default <- FALSE installed <- installed.packages() if …