Based on some simple tests, interactive()
is true when running code within rmarkdown::render()
or knitr::knit2html()
. That is, a simple .rmd
file containing
```{r}
print(interactive())
```
gives an HTML file that reports TRUE
.
Does anyone know of a test I can run within a code chunk that will determine whether it is being run "non-interactively", by which I mean "within knit2html() or render()"?