yihui/knitr — pull request #489 by BrianDiggs (2013-02-25 19:51:43+00:00)
Title: Promote envir to named argument in kint2html

Added an explicit named argument `envir` to the signature of `knit2html`
(after the `...` argument) because calls to `knit2html` from `knit_rd`
specified an `envir` argument which was being passed to
`markdown::markdonwToHTML` (via `...`) which does not have that argument
and it was not being passed to `kint` which is where it was supposed to go.

This caused two errors in `knit_rd()` The first was an error on every page with examples. Here is the output of one of those:

```r
** knitting documentation of aes
|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | 50%
label: unnamed-chunk-1
|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>| 100%
ordinary text without R code

Error in markdown::markdownToHTML(text = out, ...) :
unused argument(s) (envir = )
```

The second problem was that evaluation of the examples could overwrite variables in the `knit_rd` function if they had the same name. This happened with `ggplot2`'s `aes_group_order` page which defined `p` as a `ggplot` object while `p` was the iterating index in `knit_rd` and so when passed to `str_c` to create the output file name gave the error

> Error: Input to str_c should be atomic vectors

which would terminate the knitting.