yihui/knitr — Issue #59: Standardizing chunk options for easier recall
Author: ramnathv
Created: 2011-12-16 04:05:36+00:00
State: open

One of the key drivers for adoption of an R package apart from functionality is its ease of use. A key reason why packages like `plyr`, `ggplot2` and `stringr` have a large user base is consistency in syntax. While I understand that lot of the chunk options in `knitr` were restricted in syntax due to the legacy effects of `Sweave`, I believe, it would be good to make a clean break and set the path for more consistent syntax. Here is what I propose, and I should warn you that it is heavily biased based on what I consider consistent syntax.

There are a set of options that control display of text : `message`, `warning`, `error`, `prompt`, `echo`, `tidy`, `highlight` and `results`. These option names are concise and are unambiguous, hence good.

There are a set of options that control display of plots. Here is where I believe there is scope for more consistency. I would prefix every option related to plot with `fig`. Here is how it would change the current options

`prefix.string` => `fig.path`
`align` => `fig.align`
`animate` => `fig.animate`
`width` => `fig.width`
`height` => `fig.height`

Finally, the remaining chunk options, that I would rename are

`prefix.cache` => `cache.path`

I have put together a [wiki page] (https://github.com/ramnathv/knitr/wiki/Chunk-Options) with the objective of organizing the chunk options by theme, and that is when I noticed the inconsistency.

I know that the opinions expressed here might be biased, but I still wanted to put them out here, so that others can comment.