how to tell if code is executed within a knitr/rmarkdown context?

前端 未结 3 413
忘了有多久
忘了有多久 2021-01-03 21:40

Based on some simple tests, interactive() is true when running code within rmarkdown::render() or knitr::knit2html(). That is, a simp

3条回答
  •  囚心锁ツ
    2021-01-03 22:09

    As Yihui suggested on github isTRUE(getOption('knitr.in.progress')) can be used to detect whether code is being knitted or executed interactively.

提交回复
热议问题